undefined reference to DirectDrawCreate@12,
Members - Reputation: 106
Posted 08 July 2014 - 02:04 AM
An old thread on the subject mentioned that ddraw.lib might be missing. After installing the DXSDK_Feb10.exe package from Microsoft, which is the last version to include ddraw.lib, I had the lib on my system.
I executed the shell script for setting proper ENV variables for VC++ and the related script for the DX SDK, compiled my source and when it hit the linker, bam. Fail.
I had direct.h in my topmost include file and ddraw.lib in my Makefile. No dice. I tried adding dxguid.lib and moved ddraw.lib to the top of my LIBRARIES order. Still failed.
Turns out that on x86-64 systems, the shell script for setting the LIB path for the DX SDK defaults to using x86-64 libs. That old function didn't exist in the 64-bit library. I had to tell it to set my ENVs specifically for x86.
Once that was fixed, the linker worked. I didn't need to include dxguid.lib, extern statements or fancy pragma statements in my code, either. So for people running 64-bit systems, be aware of which set of libs you're linking to and save yourself a lot of grief.