473,725 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LNK 2001 error using the cl compiler??

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\AdvAPI3 2.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_INCLU DE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE% \win
32 -LD RegConnect.c -FeRegConnect.dl l
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:RegConne ct.lib
/out:RegConnect. dll
RegConnect.obj
Creating library RegConnect.lib and object RegConnect.exp
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegClose Key@4
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegQuery ValueE
xA@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegOpenK eyExA@
20
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegConne ctRegi
stryA@12
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__wsprintf A
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegSetVa lueExA
@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegCreat eKeyEx
A@36
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegDelet eKeyA@
8
RegConnect.dll : fatal error LNK1120: 8 unresolved externals

2) LINK environment variable is: "C:\Program Files\Microsoft
SDK\Lib\AdvAPI3 2.Lib":
cl -I%WINDOWS_INCLU DE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE% \wi
32 -LD RegConnect.c -FeRegConnect.dl l
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\AdvAPI3 2.Lib"
/dll
/implib:RegConne ct.lib
/out:RegConnect. dll
RegConnect.obj
Creating library RegConnect.lib and object RegConnect.exp
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__wsprintf A
RegConnect.dll : fatal error LNK1120: 1 unresolved externals
3) LINK environment variable is: "C:\Program Files\Microsoft
SDK\Lib\User32. Lib":
cl -I%WINDOWS_INCLU DE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE% \win
32 -LD RegConnect.c -FeRegConnect.dl l
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:RegConne ct.lib
/out:RegConnect. dll
RegConnect.obj
Creating library RegConnect.lib and object RegConnect.exp
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegClose Key@4
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegQuery ValueE
xA@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegOpenK eyExA@
20
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegConne ctRegi
stryA@12
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegSetVa lueExA
@24
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegCreat eKeyEx
A@36
RegConnect.obj : error LNK2001: unresolved external symbol
__imp__RegDelet eKeyA@
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\AdvAPI3 2.Lib;C:\Progra m
Files\Microsoft SDK\
Lib\User32.Lib"
cl -I%WINDOWS_INCLU DE% -I%JAVA_INCLUDE% -I%JAVA_INCLUDE% \win
32 -LD RegConnect.c -FeRegConnect.dl l
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\AdvAPI3 2.Lib;C:\Progra m
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:RegConne ct.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
Nov 14 '05 #1
2 5835
ma***********@y ahoo.com (Mary) wrote in
news:97******** *************** ***@posting.goo gle.com:
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,


Mary, C does not specify how the cl compiler works, does not support
classes (that's C++), nor does it include the win32 API. Thus, this
question is off-topic here. There are many Microsoft newsgroups available,
I suggest you find one that deals with win32 and programming.

--
- Mark ->
--
Nov 14 '05 #2
Mary wrote:
Hello,

I am having a problem with the cl compiler. I have written a C class
No, you didn't. There is no such thing as a 'class' in C. Perhaps you
meant the different languagee C++, for which there is a newsgroup
news:comp.lang. c++ but ... (RegConnect.c) which uses Win32 API functions such as RegOpenKey,
RegCloseKey etc. Initially when I was trying to create a dll,


Win32 API functions and DLLs are not part of C++ either. Perhaps you
want a newsgroup, mailing list, or tech support for your implementation
or for Windows.

Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6407
by: yanwan | last post by:
I met this problem in executing a c++ project in visual studio. Does anyone have suggestions to resolve "error lnk 2001"? --------------------Configuration: reconstruction - Win32 Debug-------------------- Linking... icarus_camera.obj : error LNK2001: unresolved external symbol _dgels_ icarus_leastsquares.obj : error LNK2001: unresolved external symbol _dgels_ icarus_maths.obj : error LNK2001: unresolved external symbol _dgels_...
13
2228
by: Dr John Stockton | last post by:
Javascript date strings can have a one-letter postfix; it is taken as indicating time zone (not J, which causes NaN). // IIRC, VB accepts A & P in that location, for AM & PM. In my MS IE 4, the object generated by new Date("2001/1/1 0:0:0R") has value meaning Sun Dec 31 19:00:00 UTC 2000. That combination of local time and UTC corresponds, AIUI, to Tashkent and Karachi, in Asia (and not to any US towns of the...
1
3374
by: stoppal | last post by:
I have the below function written in VB, and everything works fine EXCEPT that the sql code is not executing correctly. The date field is in the table always shows "12/1/1899 11:59:17 PM" no other date. I'm should have the date of the input into the function + or - the integer in the task_due_days field. for example (cdate("1/1/2002")+30) as task_due_date What am I doing wrong?
17
7460
by: Steve Jorgensen | last post by:
If you've ever employed custom error numbers and messages in you programs, you've probably ended up with code similar to what I've ended up with in the past something like... <code> public Const xyzcErrNumBase As Long = 500 Public Const xyzcErrNumHeyDontDoThat = xyzcErrNumBase + 1 Public Const xyzcErrTxtHeyDontDoThat = "Hey! Don't do that!"
16
2853
by: pj | last post by:
(Was originally, probably wrongly, posted to the vc subgroup.) (This doesn't appear to be a c# problem, but a problem with a bug in the Visual Studio c# compiler, but, any help will be welcome...) Oh, I forgot to list the error messages; I would be delighted if someone could explain how to deduce which line number in which file is the one that the VC compiler cannot handle. Actually I'm using C#, but the only post I could find about...
0
1419
by: Tim Sharrock | last post by:
We have hit an internal compiler error when processing a very long array initialiser (for a lookup table). Most of the compiler versions we tried compiled the code successfully, but very slowly (one person reported hours, but I have not seen that personally), but one failed: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. slow.c
10
2841
by: k.jayachandran | last post by:
I have a very curious and unique problem here. I'm creating a parser using bison and flex. i did all the development work in a linux environment. the project includes the source files output from flex and bison, then several cpp files to create a data structure from the parser. i used gcc as the compiler for the flex output(as it is a c file) and g++ as the compiler for the remaining source files. linked all the object files to create the...
0
2052
by: erik.erikson | last post by:
I am getting a compiler error that I can't well explain or even understand the origin of (though I boiled it down close...). Below is a bare-bones example. What I am doing is defining the increment operator in a class and then defining a derived class and using the derived class. When I try to use the increment operator on an instance of the derived class (as an instance of the derived class, not when used as an instance of the base...
2
2123
by: mickey22 | last post by:
I am using a function template in my project which is member of a class and I have included the header file of this class.But I am getting a linking error LNK 2001: error LNK2001: unresolved external symbol "public: float __thiscall test::fillvalue<float>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::vector<class h *,class std::allocator<class h *> > *,struct Filter::t * const,class...
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.