c and c++ compatibility -


i have downloaded code written in c, i've written cmakelists.txt access through eclipse , works fine , compiles.

my personal code written in c++. want call c code it, , i've created cmakelists.txt takes account c code is.

when build project there's no problem, long don't following instruction :


// in 1 of project's .cpp :

#ifdef __cplusplus    extern "c" { #endif    #include "c_header_file_i_need.h" #ifdef __cplusplus } #endif 

// core of .cpp


the errors given tell me program attempting compile c code c++ compiler , therefore :

  • nested functions

  • void*

  • ...

are not accepted compiler.

i've considered adapting c program, lot of work ...

since it's 1 compiler per cmakelists, wondering how able compile 2 parts of project independently , link them, using cmakelists (because need work on platform).

thank you help, , not hesitate tell me file/log need at.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -