Code::Blocks not recognizing extern "C" blocks

Hi, LeafyCircuits here!

Comp specs:
OS: Windows 7 Home Premium 64-bit
Compiler: MinGW 4.6.2
IDE: Code::Blocks 12.11

Apparently, Code::Blocks doesn't recognize extern "C" blocks, and I'm not sure how to fix this. I've done a little research, and none of the sources really explained how to fix this (they claim it's a piece of cake). If anyone uses Code::Blocks and knows how to fix this, please help me out. I'm in a dire need for <stdlib.h> (>ω<)
Last edited on
#include <cstdlib>

> Code::Blocks doesn't recognize extern "C" blocks
¿recognize them how? it is not a compiler, you know.
Last edited on
Are you sure you are compiling as C++ code and not as C code ? Code::Blocks has an option for this.

Is __cplusplus defined ?

modoran said:
Is __cplusplus defined ?


I'm not really sure how to check this. Would this be under the #defines tab in compiler settings?
1
2
3
#ifdef __cplusplus
std::cout << "C++ mode" ;
#endif 
Last edited on
Actually, never mind. I tried amhndu's code, and I do have __cplusplus defined. What I was doing wrong is using an #include inside a function definition. It was a nesting error. That's why the errors looked like my compiler wasn't recognizing extern "C" blocks.

Thanks anyways for trying to point me in the right direction. Lol my bad ^_^
Last edited on
Topic archived. No new replies allowed.