c++ - AIX 服务器中的 g++ 编译 - 抛出核心转储

标签 c++ c g++ aix

我有以下代码。

猫样本.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/

相关文章:

c - 整数类型显示 10-bits RGB 用于显示

c++ - 将 shared_ptr 与指向指针的指针一起使用时出现编译器错误

c++ - 在坐标类型上对我的类进行模板化并使用 Boost Geometry 库时出现编译错误

c++ - 遍历多维数组时遇到问题

c++ - 带点更新的范围总和范围

c++ - 命令模式 : Where to create the Command items?

一个符合标准的 C 实现#define NULL 可以是古怪的东西吗

C HTTP Proxy,浏览器无限期显示 "waiting for"

c++ - vector::push_back 什么时候增加容量?

c++ - malloc 错误“命名管道打开时内存损坏(快速)