Skip to main content
gamedev.net
🔒 Locked

LINK error :(

Started by GameDev.net Nov 2, 2005 at 1:49 AM 3 replies 550+ views
Original Post
GameDev.net
GameDev.net
A good day to you! I've just setup a mixture of - Code::Blocks IDE, - Visual C++ 2003 .NET Toolkit, - latest Platform SDK, - and the april release of DirectX 9.0c SDK. I've included lots of libs into the linker, but I probably missed one... In the Win32 Release everyting runs just fine: compile, link and play :) But in the Win32 Debug target, I got a few stupid link errors about the invalid usage of the "new operator" by some IO libraries: libcid.lib(streamb.obj) - LNK2001: unresolved external symbol "void *__cdecl operator new(unsigned int, int, char const *, int)"(??2@YAPAXIHPBDH@Z) libcid.lib(fstream.obj) - LNK2019: unresolved ... referenced in fstream::fstream(void) ... libcid.lib(_ios.obj, ifstream.obj, filebuf1.obj) - LNK2001: some as above... What's wrong?
Taha Ansari
Taha Ansari
Assuming there are not many .lib files that you have included in your solution... you might find the following hit and try solution useful:

- Open up two instances of Visual Studio.Net.
- Open up the same solution on both IDEs.
- Goto Project-> Properties (for both).
- For one IDE open, select Release Configuration from top left drop down box, and for other, Debug configuration.
- Click Linker->Input. Open Additional dependancies (for both).
- [There should'nt be many files here], you can compare each file to see which is missing in the Debug configuration..

There is the possiblity error can be traced from here, as fstream that is in the error message should be included by VS.net by default (I assume), so, missing lib could be in the additional dependencies tab mentioned above.

Ofcourse, there are other places where the missing lib file could included in Release, and not in Debug configuration...above solution is worth a try.
LessBread
LessBread
And what about the C Runtime(crt)? That one of the link errors reads

unresolved external symbol "void *__cdecl operator new

suggests quite strongly to me that you haven't linked with the crt. Check out the "C Run-Time Libraries" link I dropped earlier. You might need to link with LIBCPMTD.LIB or MSVCPRTD.LIB when in debug mode.

I would favor the lib files that came with the PSDK and the VC Toolkit instead of the ones that you got from VC5. I would also keep a list of the ones from VC5 so that it's easier to replace them if the need arises.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.