Thread: Linker errors.

  1. #1
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476

    Linker errors.

    Hi, I've got this linker error but don't know what to do.

    6> Creating library ..\_libd\resmgr.lib and object ..\_libd\resmgr.exp
    6>d3dx9.lib(d3dx9dbg.obj) : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function "int __stdcall GetD3DRegValue(unsigned long,char *,void *,unsigned long)" (?GetD3DRegValue@@YGHKPADPAXK@Z)
    6>d3dx9.lib(cpudetect.obj) : error LNK2001: unresolved external symbol __imp__RegCloseKey@4
    6>d3dx9.lib(d3dx9dbg.obj) : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function "int __stdcall GetD3DRegValue(unsigned long,char *,void *,unsigned long)" (?GetD3DRegValue@@YGHKPADPAXK@Z)
    6>d3dx9.lib(cpudetect.obj) : error LNK2001: unresolved external symbol __imp__RegQueryValueExA@24
    6>d3dx9.lib(d3dx9dbg.obj) : error LNK2019: unresolved external symbol __imp__RegOpenKeyA@12 referenced in function "int __stdcall GetD3DRegValue(unsigned long,char *,void *,unsigned long)" (?GetD3DRegValue@@YGHKPADPAXK@Z)
    6>d3dx9.lib(cpudetect.obj) : error LNK2001: unresolved external symbol __imp__RegOpenKeyA@12
    6>d3dx9.lib(cresource.obj) : error LNK2019: unresolved external symbol __imp__DeleteObject@4 referenced in function "public: __thiscall D3DXCore::CResource::~CResource(void)" (??1CResource@D3DXCore@@QAE@XZ)
    6>dxerr9.lib(dxerr9.obj) : error LNK2019: unresolved external symbol __imp__MessageBoxW@16 referenced in function _DXTraceW@20
    6>dxerr9.lib(dxerr9.obj) : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function _DXTraceA@20
    6>../_bind/resmgr.dll : fatal error LNK1120: 6 unresolved externals
    This is what I've done so far to try to solve this:
    1. Including the DX9 directory to the Visual Studio's general option (Tools->Options->Projects & Solutions->VC++ Directories->Include Files & Library Files) == failed
    2. Including the directory directly to the project == failed
    3. Check if I declared the project as en DLL instead of EXE == already declared as DLL
    4. Check if there's a DLLMain instead of a WinMain == it's already a DLLMain
    5. Disable Unicode == already using multi-byte. if I turn the Unicode on, it would show a completely different error message.

    A little bit of info for the project:
    1. It's a DLL project
    2. I actually copied the whole solution from my co-worker because we will be doing the same thing together. I've changed all the directories in the settings to correspond my computer (which I thought would make no difference to his settings). Funny thing is it worked fine in his computer.
    3. The project that called the err'd function is actually not this project itself, but rather one of the projects that's in its dependency.
    4. If I compile that one project in the faulty project's dependency (the one that calls the err'd function) itself, it would compile just fine. But if I compile it in sequence with this faulty project, it would show those errs.

    So, I'm so lost right now. Can anybody give any suggestion about this? Thanks very much.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

  2. #2
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    You're not linking to some external library that's being used. Based on the function calls which it brings up MessageBox, RegOpenKey, it looks like you're missing a link to one of the basic windows components. Don't know this off the top of my head, maybe someone else around here will know.



    [edit]

    If you copied the settings, then maybe he references libraries which you have located in a different directory.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  3. #3
    a newbie :p
    Join Date
    Aug 2008
    Location
    Zurich, Switzerland, Switzerland
    Posts
    91
    how about directx sdk... do you have them?

    check on this thread: http://www.gamedev.net/community/for...opic_id=465306

    how about platform sdk (psdk)... some forums say it is related....

  4. #4
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    @neandrake: I've changed the directory settings to correspond my computer. So AFAIK it should be fine. Also what I can't understand is these facts:
    Say, the faulty project is called projectA and it has a dependency to another project called projectB.
    1. There's no call to the faulty functions (MessageBox, RegOpenKey, etc) inside projectA but there are some in projectB
    2. If I compile projectB alone, it would be just fine
    3. If I compile projectA (and automatically compile projectB), it would show those error message

    @auralius
    I already have both of them and included the directories to the project.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

  5. #5
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Neverminde. I've solved it. It seems that the project is lacking a few libs (Gdi32.lib, advapi32.lib, and user32.lib). The weird thing is, it was compiled with success in my friend's computer. And the project settings was the same as my faulty project (lacking those 3 libs). Well, at least it can compile now. Thanks though guys.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker errors
    By jw232 in forum C++ Programming
    Replies: 3
    Last Post: 06-12-2009, 12:56 PM
  2. Linker errors in VC++ 2005
    By C+/- in forum C++ Programming
    Replies: 0
    Last Post: 05-18-2007, 07:42 AM
  3. Sneaky little linker errors...
    By Tozar in forum C++ Programming
    Replies: 8
    Last Post: 10-25-2006, 05:40 AM
  4. Linker errors with Visual C++
    By codegirl in forum C++ Programming
    Replies: 4
    Last Post: 09-11-2003, 09:20 AM
  5. MSVis-Studio C++ libraries and linker errors
    By kellydj in forum Windows Programming
    Replies: 10
    Last Post: 03-12-2002, 02:03 PM