|
|
发表于 2006-7-14 19:29:35
|
显示全部楼层
http://geneura.ugr.es/~jmerelo/c++-faq/mixing-c-and-cpp.html
第一个问题的答案是,c和c++的语法不一样... c++并不是c的一个超集.
- // C++ 代码
-
- extern "C" {
- // Get declaration for f(int i, char c, float x)
- #include "my-C-code.h"
- }
-
- int main()
- {
- f(7, 'x', 3.14); // Note: nothing unusual in the call
- ...
- }
复制代码
用gcc编译libamr 用g++编译main.cc 最后用g++链接. |
|