Hello forum,
I am working on a project using c and c++ code with eCos. I notice that eCos is written mainly in c++, but many other components in my system is written with c. This leads me to suspect that mixing c and c++ works OK if you know how. I have no trouble running an example project written in c, but when I start to incorporate cxx code files, things start to look bad. Before someone says, 'post to the eCos forum', my question is more fundamental - how do you go about mixing c and cxx code in the context of gcc and the NiosII IDE? Thanks in advance for any replies.链接已复制
3 回复数
Hi,
You can find much info from google.com.cn by using key words "mixing C and C++". when using C++ style function in *.c file, you'll need to do a "C"-style function in the CPP file in order to to link it. e.g. in CPP extern "C" void CreateForm (void) { Form *frm = new Form(); } then in main.c extern void CreateForm (void); int main () { CreateForm () } FYI. DavidHi
Here i passed one link..from that you can get the idea and also solution for mixing c/c++ code in one file... http://developers.sun.com/prodtech/cc/articles/mixing.html (http://developers.sun.com/prodtech/cc/articles/mixing.html) Go through this. Definately you find the solution.. Let me know Best Regards, slsnios