/tmp/ccQ0q0g5.o:(.eh_frame+0x11): 对 `__gxx_personality_v0' 的未定义引用 collect2: ld 返回 1 退出状态

/tmp/ccQ0q0g5.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status

使用 Makefile 编译时出现错误

/tmp/ccQ0q0g5.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

好像少了.so.a个文件,但是这样的报错怎么知道少了哪个呢?

生成文件:

CFLAGS = -Iinclude/
CFLAGS += -m32 
LDFLAGS = -Llib -llits -lrt -lpthread -Wl,-R,'lib'
server:server.cc
    gcc -o server $(CFLAGS) $(LDFLAGS) server.cc

您正在编译 C++,但没有link访问 C++ 运行时库。

使用 g++ 到 link C++ 程序,而不是 gcc

(或者手动添加-lstdc++到linker命令)。