Can I set the gcc-compiler to only compile C-code? My main concern is, that I want to get a compiler error, if I try to use any C++ syntax, or even try to make use of the STL. Since I’m using Codeblocks it would be nice if you could point out how to change it there, but I’m sure I’d figure that bit out.
Share
Use the -std option, for example gcc -std=c89 says you want it to behave as if you are compiling C89 code. You will also probably want to use the -pedantic option, and give your files the .c extension, rather than .cpp. Also, gcc likes to allow its own extensions, which are not part of C or C++, and -pedantic will turn most of these off.