我正在编译一组 .C 文件并尝试使用 xlC 编译器版本 9.0 在 AIX 6.0 上创建目标文件。它产生以下错误:
1540-1172 (S) More than one function "operator new" has non-C++ linkage.
1540-0424 (I) "operator new" is declared on line 92 of "/usr/vacpp/include/new".
1540-0121 (S) A template cannot have "C" linkage.
1540-0140 (S) The text "<" is unexpected. "List" may be undeclared, ambiguous, or may require "typename" qualification.
任何形式的指导或帮助将不胜感激。
$ xlC -qversion
C for AIX version 6.0.0.0
编译器 xlC 只是一个 C++ 编译器。我已经确认 #include 周围没有 extern 'C'。如果有人处理过此问题,请告诉我解决方案。
最佳答案
当您尝试在 extern "C"中重载函数时会出现该消息
外部“C”{
结构 A{};
结构 B{};
无效测试(一个参数);
无效测试(B arg);
“q.cpp”,第 5.9 行:1540-1172 (S) 不止一个函数“test”具有非 C++ 链接。
“q.cpp”,第 4.9 行:1540-0424 (I) “test”在“q.cpp”的第 4 行声明。
关于c - AIX 6.0 环境下的 xlC 编译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18984521/