I created a C++ project that contains several source files and header files. The program compiles and runs well in codeblocks, but I can't compile it in terminal.
All the files are in the same folder.
Here are the command I enter:
clang++ -std=c++11 main.cpp file1.cpp file1.h
clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated
error: use of undeclared identifier 'std'
You should to avoid to compile an header file (
clang++ -std=c++11 main.cpp file1.cpp
The header file is something that the preprocessor will include in the cpp files which need it (those compilation units which use
#include pre-processor directive).