Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Well, I ran into the same issue. I'm perfectly happy to code in C++, but I had some existing code written in C that I wanted to tie into as well without having to re-code it in C++. Fortunately, it's possible to do both-- I ended up creating a simple C++ file that wrappered the necessary calls for C, and then was able to add my C source and call the C++ functions as needed. It works fine and wasn't very hard to do. In my case main() is in C but it can be done the other way as well with C++ calling C. Now I have a project with a makefile that includes the two source files (right now there's only two because it's a very simple project), where I can code stuff in either C or C++ as is convenient and just put it in the right file for it...