Compiling C and C++ code in the same project [message #1850386] |
Mon, 28 February 2022 15:56  |
Eclipse User |
|
|
|
Does anyone know how to create a project where the compiler compiles c source files with GCC and C++ source files with g++? I don't really need to do it this way. All I'm trying to achieve is to have the main c file (main.c) that calls functions from other files whether they are c or c++ source files. For example, I would like to be able to include a header from a c++ source file so in my int main() I can call add(2,3) and the output would be 5 (the add function would exist in a c++ source file). However, when I try using g++ to compile the entire project, there are many build errors in the c source files. When I try using GCC to compile the project, the c++ source files are ignored. I would love to be able to convert an existing project to be compatible with both c and c++ but I'm also open to creating a new project from scratch to do this as long as I can work with both C and C++. Just in case this matters, I wanted to mention that I am using Eclipse CDT on Xilinx SDK. Thanks!
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.12647 seconds