undefined reference to `XF86VidModeSwitchToMode'

2.1k views Asked by At

When I compile the physx's demo in ubuntu 12.04 there always appear some errors just like

./../../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'

I add the header include the functions which the compiler has mentioned, but the errors still appear. I am exhaust. Can anybody help me?

1

There are 1 answers

0
DemiDroL On

Just add the -lXxf86vm -lXext -lX11 flags to your linker settings. And don't forget install libxxf86vm-dev package in aptitude.