【问题标题】:xlC compilation issue in AIX 6.0 environmentAIX 6.0 环境中的 xlC 编译问题
【发布时间】:2013-09-29 20:11:05
【问题描述】:

我正在编译一组 .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" {,后跟 #include &lt;new&gt; 和 },三行。或者,可能是您使用的是 C 编译器而不是 C++ 编译器,但这更有可能抱怨 operator new 的语法而不是允许它,除非有几个 operator new 声明都带有extern "C"link。

标签: c compiler-construction aix linkage xlc


【解决方案1】:

当您尝试在 extern "C" 中重载函数时会出现该消息


外部“C”{
结构 A{};
结构 B{};
void test(A arg);
无效测试(B arg);
}


“q.cpp”,第 5.9 行:1540-1172 (S) 多个函数“test”具有非 C++ 链接。
“q.cpp”,第 4.9 行:1540-0424 (I)“test”在“q.cpp”的第 4 行声明。

【讨论】:

  • 感谢凯瑟琳的指导。我会检查这是否适用于我的代码并更新。
  • Catherine,我已经彻底检查过了,extern "C" 块中没有定义这样的重载函数...如果有其他原因,请告诉我...提前致谢
猜你喜欢
  • 2018-03-15
  • 2015-12-28
  • 2013-03-04
  • 2011-06-18
  • 2012-01-27
  • 2011-02-10
  • 1970-01-01
  • 1970-01-01
  • 2011-07-26
相关资源
最近更新 更多