473,692 Members | 2,747 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 5834
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
6403
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
2223
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
3371
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
7456
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
2850
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
1418
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
2838
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
8611
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
9094
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...
1
8814
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
7642
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6468
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5823
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
4565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2244
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.