User forums > Using Code::Blocks
mixed project C99 and C++
ToApolytoXaos:
I wish I could see your project, because I have created a header file with extern C linkage, an implementation file, and called my function within C++ main() function.
Is your project heavily using dot operations within structures to initialize values? If yes, that would indeed going to cause problems.
For more information read the following article: Incompatibilities Between ISO C and ISO C++
Audiodroid:
Thank you so much for looking into this. For the moment is has to remain a mystery I guess.
As soon as I'm not under that much time pressure, I will make a dummy project to illustrate the problem. Then either I get a hang of it and post the solution here, or I'll post the code and if I'm lucky you have the answer. ;-)
Thanks again for all your help so far!!!
thomas:
There's no easy or pretty way to get this right, unluckily. You can compile a project build target with or without some compiler flag (so either you're breaking it for C++ files or you're breaking it for C files), and you can assign individual command to each single file, but this isn't practical for a hundred files (nor is is very straightforward or plays well with project options or portability).
If the compiler's extension-based auto-detection doesn't work, you're kind of at loss with mixed files.
The best thing you can do is make 2 build targets, one with all the C files, and one with all the C++ files (give the appropriate -std=... flag to each), and link the object files together.
osdt:
Which C::B version do you use? At least the current SVN version filters out C-Only flags when calling g++ and CPP-Only flags when calling gcc. I'm using '-std=c++11 -std=c11' within 'Compiler->Other Options' for mixed projects and it works perfectly.
- osdt
Navigation
[0] Message Index
[*] Previous page
Go to full version