question about g++

chongchong

知名会员
注册
2003-11-04
消息
163
荣誉分数
0
声望点数
126
I have a small C++ program (with main function) which is compiled by g++. I also define a function abc() in a C program which is compile by using gcc. The abc is invoke by the C++ program. When I try to link them together, I failed on a error message as "undefined referece abc()". However, I have no problem to link them together if I compile all of them by using g++.

Can anybody help me on this issue?
 
use nm or objdump to dump the lib of your c to show what is the name of abc, maybe you should use extern "C" {} to include the declaration in C++.

c++ and C have different name convention.
 
后退
顶部