Forum Discussion
Altera_Forum
Honored Contributor
17 years agoNios II - mixed C and C++ project problem
Hi everybody, I'm a newbie with Nios II IDE (Version: 9.0 Build: 132) and have following problem when building project with both C and C++ (.cpp) files. - project with source files (al...
Altera_Forum
Honored Contributor
17 years agoUse extern "C" when mixing C++ and C code
__cplusplus will be automatically defined if your compiler is a C++ compiler Use this in your header files ...#if defined(__cplusplus)
extern "C" { // Make sure we have C-declarations in C++ programs # endif
void yourCFunction();
# if defined(__cplusplus)
}# endif Have a look a this link http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html (http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html) Best regards