M
Mary
Hello,
I am having a problem with the cl compiler. I have written a C class
(RegConnect.c) which uses Win32 API functions such as RegOpenKey,
RegCloseKey etc. Initially when I was trying to create a dll, using
the cl compiler I was getting many unresolved external errors, Example
1 below (8 in total, 7 to do with the registry function calls and 1
from wsprintfA call) as I hadn't included the AdvAPI32.lib file. So I
created a LINK environment variable and set the value to be
"C:\Program Files\Microsoft SDK\Lib\AdvAPI32.lib". When I tried to
generate the dll again I only got 1 link error this time, Example 2,
for wsprintfA. I modified the LINK environment variable, to change the
value to "C:\Program Files\Microsoft SDK\Lib\User32.lib", and re ran
the command, This time I got 7 errors, the 7 registry errors but the
wsprintfA wasn't one of the errors! So I know I need to include both
the User32.lib (for wsprintfA ) and AdvAPI32.lib for the calls to the
Win32 API functions. But if I change the LINK environment variable to
have 2 files, I get LNK2001 error: cannot find file, example 3 below.
1) No LINK environment variable:
cl -I%WINDOWS_INCLUDE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE%\win
32 -LD RegConnect.c -FeRegConnect.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
RegConnect.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/dll
/implib:RegConnect.lib
/out:RegConnect.dll
RegConnect.obj
Creating library RegConnect.lib and object RegConnect.exp
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegCloseKey@4
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegQueryValueE
xA@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegOpenKeyExA@
20
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegConnectRegi
stryA@12
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__wsprintfA
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegSetValueExA
@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegCreateKeyEx
A@36
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegDeleteKeyA@
8
RegConnect.dll : fatal error LNK1120: 8 unresolved externals
2) LINK environment variable is: "C:\Program Files\Microsoft
SDK\Lib\AdvAPI32.Lib":
cl -I%WINDOWS_INCLUDE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE%\wi
32 -LD RegConnect.c -FeRegConnect.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
RegConnect.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
"C:\Program Files\Microsoft SDK\Lib\AdvAPI32.Lib"
/dll
/implib:RegConnect.lib
/out:RegConnect.dll
RegConnect.obj
Creating library RegConnect.lib and object RegConnect.exp
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__wsprintfA
RegConnect.dll : fatal error LNK1120: 1 unresolved externals
3) LINK environment variable is: "C:\Program Files\Microsoft
SDK\Lib\User32.Lib":
cl -I%WINDOWS_INCLUDE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE%\win
32 -LD RegConnect.c -FeRegConnect.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
RegConnect.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
"C:\Program Files\Microsoft SDK\Lib\User32.Lib"
/dll
/implib:RegConnect.lib
/out:RegConnect.dll
RegConnect.obj
Creating library RegConnect.lib and object RegConnect.exp
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegCloseKey@4
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegQueryValueE
xA@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegOpenKeyExA@
20
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegConnectRegi
stryA@12
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegSetValueExA
@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegCreateKeyEx
A@36
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegDeleteKeyA@
8
RegConnect.dll : fatal error LNK1120: 7 unresolved externals
4) when i include both in the LINK environment variable:
"C:\Program Files\Microsoft SDK\Lib\AdvAPI32.Lib;C:\Program
Files\Microsoft SDK\
Lib\User32.Lib"
cl -I%WINDOWS_INCLUDE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE%\win
32 -LD RegConnect.c -FeRegConnect.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
"C:\Program Files\Microsoft SDK\Lib\AdvAPI32.Lib;C:\Program
Files\Microsoft SDK\
Lib\User32.Lib"
RegConnect.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/dll
/implib:RegConnect.lib
/out:RegConnect.dll
RegConnect.obj
LINK : fatal error LNK1104: cannot open file "C:\Program
Files\Microsoft SDK\Lib
\AdvAPI32.Lib;C:\Program Files\Microsoft SDK\Lib\User32.Lib"
I have also tried the newer version of the cl compiler (version 13...)
but it still doesn't work!!!
Is it how I can't have 2 paths in the LINK variable?
Please HELP as this is driving me in sane!!
Thanks in advance!
Mary
I am having a problem with the cl compiler. I have written a C class
(RegConnect.c) which uses Win32 API functions such as RegOpenKey,
RegCloseKey etc. Initially when I was trying to create a dll, using
the cl compiler I was getting many unresolved external errors, Example
1 below (8 in total, 7 to do with the registry function calls and 1
from wsprintfA call) as I hadn't included the AdvAPI32.lib file. So I
created a LINK environment variable and set the value to be
"C:\Program Files\Microsoft SDK\Lib\AdvAPI32.lib". When I tried to
generate the dll again I only got 1 link error this time, Example 2,
for wsprintfA. I modified the LINK environment variable, to change the
value to "C:\Program Files\Microsoft SDK\Lib\User32.lib", and re ran
the command, This time I got 7 errors, the 7 registry errors but the
wsprintfA wasn't one of the errors! So I know I need to include both
the User32.lib (for wsprintfA ) and AdvAPI32.lib for the calls to the
Win32 API functions. But if I change the LINK environment variable to
have 2 files, I get LNK2001 error: cannot find file, example 3 below.
1) No LINK environment variable:
cl -I%WINDOWS_INCLUDE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE%\win
32 -LD RegConnect.c -FeRegConnect.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
RegConnect.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/dll
/implib:RegConnect.lib
/out:RegConnect.dll
RegConnect.obj
Creating library RegConnect.lib and object RegConnect.exp
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegCloseKey@4
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegQueryValueE
xA@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegOpenKeyExA@
20
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegConnectRegi
stryA@12
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__wsprintfA
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegSetValueExA
@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegCreateKeyEx
A@36
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegDeleteKeyA@
8
RegConnect.dll : fatal error LNK1120: 8 unresolved externals
2) LINK environment variable is: "C:\Program Files\Microsoft
SDK\Lib\AdvAPI32.Lib":
cl -I%WINDOWS_INCLUDE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE%\wi
32 -LD RegConnect.c -FeRegConnect.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
RegConnect.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
"C:\Program Files\Microsoft SDK\Lib\AdvAPI32.Lib"
/dll
/implib:RegConnect.lib
/out:RegConnect.dll
RegConnect.obj
Creating library RegConnect.lib and object RegConnect.exp
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__wsprintfA
RegConnect.dll : fatal error LNK1120: 1 unresolved externals
3) LINK environment variable is: "C:\Program Files\Microsoft
SDK\Lib\User32.Lib":
cl -I%WINDOWS_INCLUDE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE%\win
32 -LD RegConnect.c -FeRegConnect.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
RegConnect.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
"C:\Program Files\Microsoft SDK\Lib\User32.Lib"
/dll
/implib:RegConnect.lib
/out:RegConnect.dll
RegConnect.obj
Creating library RegConnect.lib and object RegConnect.exp
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegCloseKey@4
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegQueryValueE
xA@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegOpenKeyExA@
20
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegConnectRegi
stryA@12
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegSetValueExA
@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegCreateKeyEx
A@36
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegDeleteKeyA@
8
RegConnect.dll : fatal error LNK1120: 7 unresolved externals
4) when i include both in the LINK environment variable:
"C:\Program Files\Microsoft SDK\Lib\AdvAPI32.Lib;C:\Program
Files\Microsoft SDK\
Lib\User32.Lib"
cl -I%WINDOWS_INCLUDE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE%\win
32 -LD RegConnect.c -FeRegConnect.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
"C:\Program Files\Microsoft SDK\Lib\AdvAPI32.Lib;C:\Program
Files\Microsoft SDK\
Lib\User32.Lib"
RegConnect.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/dll
/implib:RegConnect.lib
/out:RegConnect.dll
RegConnect.obj
LINK : fatal error LNK1104: cannot open file "C:\Program
Files\Microsoft SDK\Lib
\AdvAPI32.Lib;C:\Program Files\Microsoft SDK\Lib\User32.Lib"
I have also tried the newer version of the cl compiler (version 13...)
but it still doesn't work!!!
Is it how I can't have 2 paths in the LINK variable?
Please HELP as this is driving me in sane!!
Thanks in advance!
Mary