While trying to compile c++ files at CS50 ide it seemed to be not supported by clang .. is there a specific way to fix that or it's not supported at all ?
Thanks in advance
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
C++ files, usually ending in
.C with uppercase C, or a few others), can be compiled using
Those are two different frontends (the part interpreting human-made code into a large structure) to the same backend (the part taking that structure and creating computer code).
Since CS50 is taught in C, they don't configure the IDE for C++ automatically. You need to have two environmental variables for this to work: CXX and CXXFLAGS. Open your profile like this:
c9 open ~/.profile
Then add these two lines:
export CXX="clang++" export CXXFLAGS="-std=c++11 -Wall -Wextra -O0 -ggdb3"
Save the file and restart your terminal and it should now work. If you want to use C++14, you'll also need to edit one line in the GCC standard library that is included with the CS50 ide.