0

我正在将 eclipse CDT 用于一个大型 C++ 项目,该项目已经编译了 2 年。大约 2 周前,我开始遇到一些奇怪的段错误,这些段错误毫无意义,似乎 gtk 不知何故被破坏了。所以既然是时候升级发行版了,我决定从 11.04 升级到 12.04。现在,什么都不会链接。我拥有的每个依赖项都会在链接时引发未定义的引用错误。一切都编译得很好,所有 pkg​​-config 命令都返回了它们应该返回的内容。

有任何想法吗?

这是命令:

  Invoking: GCC C++ Linker g++ `pkg-config libv4l2 --libs` `pkg-config --libs alsa` -lmysqlcppconn -lboost_regex `pkg-config sigc++-2.0 --libs` `pkg-config gstreamer-0.10 --libs` `pkg-config gstreamer-app-0.10 --libs` `pkg-config gstreamer-interfaces-0.10 --libs` `pkg-config gstreamer-rtp-0.10 --libs` `pkg-config glib-2.0 --libs` `pkg-config gtk+-2.0 --libs` -lX11 -ldl -lXext  `pkg-config gdkmm-2.4 --libs` `pkg-config glib-2.0 --libs` `pkg-config gtkmm-2.4 --libs` `pkg-config ptlib --libs` `pkg-config opal --libs` -fexceptions -o"HHPVideoServer"  ./HHPVideoCodec.o ./engine.o  ./opal/GstEndPoint.o ./opal/Linux_GstEndPoint.o ./opal/opal-call-manager.o  ./logging/log.o  ./gui/HHPVideoCodecGui.o ./gui/misc.o  ./framework/services.o  ./StreamEngine/GSTMediaStream.o ./StreamEngine/HHPStreamingEndPoint.o ./StreamEngine/HHPStreamingProtocol.o ./StreamEngine/Linux_GstMediaStream.o  ./SDKEngine/AudioSettings.o ./SDKEngine/CallSettings.o ./SDKEngine/ClientSocket.o ./SDKEngine/Communications.o ./SDKEngine/DeviceInfo.o ./SDKEngine/FileActions.o ./SDKEngine/MediaCodecs.o ./SDKEngine/NetworkSettings.o ./SDKEngine/OSDSettings.o ./SDKEngine/SDKEngine.o ./SDKEngine/SDKEngineCore.o ./SDKEngine/SIPAccount.o ./SDKEngine/ServerSocket.o ./SDKEngine/SessionScheduleDisplay.o ./SDKEngine/Socket.o ./SDKEngine/VideoInput.o  ./DigitalIO/DigitalIOCore.o ./DigitalIO/DigitalInputEngine.o   
./HHPVideoCodec.o: In function `HHPVideoCodec':
/home/jonathan/workspace/HHPVideoServer/Debug/../HHPVideoCodec.cc:9: undefined reference to `PProcess::PProcess(char const*, char const*, unsigned short, unsigned short, PProcess::CodeStatus, unsigned short, bool)'
/home/jonathan/workspace/HHPVideoServer/Debug/../HHPVideoCodec.cc:9: undefined reference to `PTimedMutex::PTimedMutex()'
/home/jonathan/workspace/HHPVideoServer/Debug/../HHPVideoCodec.cc:9: undefined reference to `PTimedMutex::PTimedMutex()'
/home/jonathan/workspace/HHPVideoServer/Debug/../HHPVideoCodec.cc:9: undefined reference to `PTimedMutex::~PTimedMutex()'
/home/jonathan/workspace/HHPVideoServer/Debug/../HHPVideoCodec.cc:9: undefined reference to `PProcess::~PProcess()'....

它持续了数千行,每个库都有一个未定义的引用。

4

1 回答 1

4

库(作为 pkg-config 的输出)应该列在 .o 文件之后。链接器的参数顺序很重要。

于 2012-05-14T21:20:03.640 回答