Search Results

Search found 1 results on 1 pages for 'fdeslaur'.

Page 1/1 | 1 

  • C++ file including C header file

    - by fdeslaur
    I need to include a C header file in my C++ project but g++ throws "not declared in this scope" errors. I read that i need to use extern "C" keyword to fix it but it didn't seem to work for me. Here is a dummy example triggering this error. main.cpp: #include <iostream> extern "C" { #include "includedFile.h" } int main() { int a = 2; int b = 1212; std::cout<< "Hello World!\n"; return 0; } includedFile.h #include <stdint.h> enum TypeOfEnum { ONE, TWO, THREE, FOUR = INT32_MAX, }; The error thrown is : $> g++ main.cpp In file included from main.cpp:4:0: includedFile.h:7:9: error: ‘INT32_MAX’ was not declared in this scope FOUR = INT32_MAX, I saw on this post that I may need #define __STDC_LIMIT_MACROS without any success. Any help is welcome!

    Read the article

1