【问题标题】:Hey. I have error in the Compiling can you someone help? Linux [closed]嘿。我在编译中有错误你能帮忙吗? Linux [关闭]
【发布时间】:2013-04-13 00:06:52
【问题描述】:

我尝试在终端中编译 c 代码,编译器向我抛出我无法理解的消息 它..

按摩师是:

user@user-virtual-machine:~/Desktop$ gcc -o run execute.cpp
execute.cpp: In function ‘void KillCommand(char*)’:
execute.cpp:389:57: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
execute.cpp: In function ‘void GetCommand(char*, char**, char*, char*, char*)’:
execute.cpp:477:129: warning: NULL used in arithmetic [-Wpointer-arith]
/tmp/ccg3lDy1.o:(.eh_frame+0x10b): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status

【问题讨论】:

  • 这是一个链接器错误,可能你缺少一些 -L。尝试用 g++ 编译(它定义了一些 C++ 的东西)

标签: c++ unix ubuntu operating-system


【解决方案1】:

如果您正在编译 C++ 代码,请使用 g++ 而不是 gcc

它设置了一些不同的标志,最重要的是它自动链接到 C++ 运行时库。

【讨论】:

    猜你喜欢
    • 2020-06-14
    • 2017-09-28
    • 1970-01-01
    • 2014-03-01
    • 1970-01-01
    • 2019-09-13
    • 2014-04-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多