I am using Code::Blocks and if I were to use c++11 in this IDE, i had to go to compiler settings, and and Check "Have g++ follow the C++11 ISO C++ language standard"
Is there any workaround so I can set a single .cpp file to use c++11 in the #define statement like this?
#include <iostream>
#define -std c++11
int main(){
#if __cplusplus==201402L
std::cout << "C++14" << std::endl;
#elif __cplusplus==201103L
std::cout << "C++11" << std::endl;
#else
std::cout << "C++" << std::endl;
#endif
return 0;
}
What I have found:
Changing #define __cplusplus 201103L is NOT a good idea, because it don't set the compiler to compile as c++11
Aucun commentaire:
Enregistrer un commentaire