Hey all,
I'm stuck here with a problem that should be simple. CL/LINK can't seem to link anything to user32.lib. There are no problems compiling with the /c option....
Here is the error:
error LNK2019: unresolved external symbol
my makefile looks like this:
syshooks:
cl $(CFLAGS) /c syshooks.cpp
cl syshooks.obj
where CFLAGS = /I. /Ox /DWIN32 /DLTN_SRC /W3 /GX
I'm running this makefile with "nmake -f makefile.msvc syshooks" from the command line. I've checked the shell to make sure that the lib env variable is being set properly, and it is:
echo %lib%
c:\Program Files\Microsoft Visual Studio .NET 2003\VC7\ATLMFC\LIB;c:\Program Fil
es\Microsoft Visual Studio .NET 2003\VC7\LIB;c:\Program Files\Microsoft Visual S
tudio .NET 2003\VC7\PlatformSDK\lib\prerelease;c:\Program Files\Microsoft Visual
Studio .NET 2003\VC7\PlatformSDK\lib;c:\Program Files\Microsoft Visual Studio .
NET 2003\SDK\v1.1\lib;
User32.lib is found in the bolded path. It looks like the compiler can't find it for some reason. I've double checked that it exists, although I'm not sure what to do now. I'm getting desperate here, does anyone have any ideas ? The same code worked fine with visual C 6.0 and Borland, but not with this new version of cl.
Thanks,
-Kilka
can't link with user32.lib VS.net 2003
Started by Kilka, Dec 27 2004 09:58 PM
4 replies to this topic
#1
Posted 27 December 2004 - 09:58 PM
#2
Posted 28 December 2004 - 01:11 AM
nothing like adding my own reply.
I'm wondering if it would be possible to list all of the symbols in the lib file, maybe the're not included for some reason. Is that possible ?
-Kilka
I'm wondering if it would be possible to list all of the symbols in the lib file, maybe the're not included for some reason. Is that possible ?
-Kilka
#3
Posted 19 January 2005 - 05:10 AM
I've made some slight progress in this department, but I am still stuck. I think it has something to do with the options that I'm passing to the linker and the compiler.
I'm finding that the following won't work
POC:
cl $(CFLAGS) POC.cpp
But that the following will work if I explicitly specify the lib
POC:
cl $(CFLAGS) /c POC.cpp (the /c just compiles but doesn't link)
link /DEFAULTLIB:user32.lib POC.obj
The code that I'm using to test this looks like. The three message functions in there are all found in windows.h which is in user32.lib.
I'm finding that the following won't work
POC:
cl $(CFLAGS) POC.cpp
But that the following will work if I explicitly specify the lib
POC:
cl $(CFLAGS) /c POC.cpp (the /c just compiles but doesn't link)
link /DEFAULTLIB:user32.lib POC.obj
The code that I'm using to test this looks like. The three message functions in there are all found in windows.h which is in user32.lib.
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
MSG message;
while (GetMessage(&message,NULL,0,0)) {
TranslateMessage( &message );
DispatchMessage( &message );
}
return 0;
}
#5
Posted 02 March 2005 - 08:18 AM
I realise that I'm bumping an old thread, and I apologise if this is wrong, but I just wanted to make sure that Kilka had an answer to his problem.
From what I can see, you're building a Windows program, but using main() instead of WinMain(). When the linker spits the error out, what's the name of the symbol that it's failed to resolve?
Hope that helps.
OJ
From what I can see, you're building a Windows program, but using main() instead of WinMain(). When the linker spits the error out, what's the name of the symbol that it's failed to resolve?
Hope that helps.
OJ
In order to understand recursion, one must first understand recursion.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











