我有以下代码。
猫样本.c
#include<stdio.h>
#include "hello.c"
int main()
{
hello_world();
return 0;
}
猫你好.c
#include<stdio.h>
void hello_world()
{
printf("Hello World");
}
使用的编译命令:
g++ -gxcoff -maix64 -shared -fpic -fpermissive -w -Ihello.c -o sample sample.c -Xlinker -e.main
执行
$./样本
段错误(核心转储)
我尝试调试核心。但是找不到太多
$dbx 样本核心
Type 'help' for help. [using memory image in core] reading symbolic information ...internal error: 1283-232 index("16;0;", ':') failed internal error: 1283-232 index("16;0;", ':') failed internal error: 1283-232 index("8;0;", ':') failed internal error: 1283-228 expected char ',', found ';-31,448,256;;' internal error: 1283-228 expected char ';', found ',256;;' internal error: 1283-232 index("256;;", ':') failed Segmentation fault in . at 0x7c0802a6f8010010 0x7c0802a6f8010010 (???) warning: Unable to access address 0x7c0802a6f8010010 from core
请帮我解决这个核心转储问题
最佳答案
g++ -gxcoff -maix64 -shared -fpic ...
上述命令构建了一个共享库,而不是您可以运行的可执行文件。从中删除 -shared
以及 -Xlinker -e.main
,它应该可以正常工作。
关于c++ - AIX 服务器中的 g++ 编译 - 抛出核心转储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30523235/