未定义的对“XF86VidModeSwitchToMode”的引用

时间:2012-05-30 06:30:28

标签: linux physx

当我在ubuntu 12.04中编译physx的演示时,总会出现一些错误,如

./../../SampleFramework/platform/lib/linux64/libSamplePlatform-MTCHECKED.a(LinuxSamplePlatform.cpp.o): In function `SampleFramework::LinuxPlatform::closeWindow()':
/home/squall/physx/Samples/compiler/linux64public/./../../SampleFramework/platform/src/linux/LinuxSamplePlatform.cpp:369: undefined reference to `XF86VidModeSwitchToMode'
/home/squall/physx/Samples/compiler/linux64public/./../../SampleFramework/platform/src/linux/LinuxSamplePlatform.cpp:370: undefined reference to `XF86VidModeSetViewPort'
./../../SampleFramework/platform/lib/linux64/libSamplePlatform-MTCHECKED.a(LinuxSamplePlatform.cpp.o): In function `SampleFramework::LinuxPlatform::openWindow(unsigned int&, unsigned int&, char const*, bool)':
/home/squall/physx/Samples/compiler/linux64public/./../../SampleFramework/platform/src/linux/LinuxSamplePlatform.cpp:271: undefined reference to `XF86VidModeQueryVersion'
/home/squall/physx/Samples/compiler/linux64public/./../../SampleFramework/platform/src/linux/LinuxSamplePlatform.cpp:299: undefined reference to `XF86VidModeGetAllModeLines'
/home/squall/physx/Samples/compiler/linux64public/./../../SampleFramework/platform/src/linux/LinuxSamplePlatform.cpp:310: undefined reference to `XF86VidModeSwitchToMode'
/home/squall/physx/Samples/compiler/linux64public/./../../SampleFramework/platform/src/linux/LinuxSamplePlatform.cpp:311: undefined reference to `XF86VidModeSetViewPort'

我添加标题包括编译器提到的函数,但错误仍然出现。 我很累。有人能帮助我吗?

1 个答案:

答案 0 :(得分:3)

只需将-lXxf86vm -lXext -lX11标志添加到链接器设置即可。并且不要忘记在aptitude中安装libxxf86vm-dev软件包。