473,739 Members | 7,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

linkage problems when building a VC7.1 project from the command line

I have a project that I normally build (without problems) from the
DevStudio IDE. However, I have embarked on automating all my builds
(this test project being one of several).

The project creates a DLL. I am able to build the project without any
probs in the IDE, however - when I build the project from the command
line (using the same options shown in the 'Command line' node in the
'Project Settings' dialog box), I get the following linkage problem (the
compilation with cl.exe seems to work ok though) - however link.exe
barfs like this:

link /OUT:timer.dll /INCREMENTAL /NOLOGO /DLL /DEBUG /SUBSYSTEM:WIND
OWS /IMPLIB:timer.li b /MACHINE:X86 Winmm.lib kernel32.lib user32.lib
gdi32.lib winspool.lib advapi3
2.lib shell32.lib
LINK : warning LNK4001: no object files specified; libraries used
LINK : error LNK2001: unresolved external symbol __DllMainCRTSta rtup@12
timer.dll : fatal error LNK1120: 1 unresolved externals

Whats going on?. I suspect I must be using lib.exe somewhere along the
line in the build process (or is this a red herring?)

May 7 '06 #1
4 5004
link /OUT:timer.dll /INCREMENTAL /NOLOGO /DLL /DEBUG /SUBSYSTEM:WIND
OWS /IMPLIB:timer.li b /MACHINE:X86 Winmm.lib kernel32.lib user32.lib
gdi32.lib winspool.lib advapi3
2.lib shell32.lib
LINK : warning LNK4001: no object files specified; libraries used
LINK : error LNK2001: unresolved external symbol __DllMainCRTSta rtup@12
timer.dll : fatal error LNK1120: 1 unresolved externals

Whats going on?. I suspect I must be using lib.exe somewhere along the
line in the build process (or is this a red herring?)


at least one problem seems to be that your link command does not take object
files as inputs.
without any object files, the linker only links the lib files, which do not
contain any entry points

If I look at a random link command on my system, it contains a list of
object files to link together.
/OUT:"D:\Project s\Visual Studio
Projects\Tryout Projects\LvArra yTemplate\Debug \LvArrayTemplat e.exe"
/INCREMENTAL /MANIFEST
/MANIFESTFILE:"D ebug\LvArrayTem plate.exe.inter mediate.manifes t" /DEBUG
/PDB:"d:\Project s\Visual Studio
Projects\Tryout Projects\LvArra yTemplate\debug \LvArrayTemplat e.pdb"
/SUBSYSTEM:CONSO LE /MACHINE:X86 kernel32.lib user32.lib gdi32.lib
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
uuid.lib odbc32.lib odbccp32.lib

".\Debug\LvArra yTemplate.obj"

".\Debug\stdafx .obj"

".\Debug\LvArra yTemplate.exe.e mbed.manifest.r es"

If your project links fine when using the IDE, check the buildlog to find
the differences between what the IDE does and what your command line does.

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"
May 7 '06 #2
Hi Bit byte

"Bit byte" <fl**@flop.co m> wrote in message
news:Cb******** ************@bt .com...
I have a project that I normally build (without problems) from the
DevStudio IDE. However, I have embarked on automating all my builds (this
test project being one of several).

The project creates a DLL. I am able to build the project without any
probs in the IDE, however - when I build the project from the command line
(using the same options shown in the 'Command line' node in the 'Project
Settings' dialog box), I get the following linkage problem (the
compilation with cl.exe seems to work ok though) - however link.exe barfs
like this:

link /OUT:timer.dll /INCREMENTAL /NOLOGO /DLL /DEBUG /SUBSYSTEM:WIND
OWS /IMPLIB:timer.li b /MACHINE:X86 Winmm.lib kernel32.lib user32.lib
gdi32.lib winspool.lib advapi3
2.lib shell32.lib
LINK : warning LNK4001: no object files specified; libraries used
LINK : error LNK2001: unresolved external symbol __DllMainCRTSta rtup@12
timer.dll : fatal error LNK1120: 1 unresolved externals

Whats going on?. I suspect I must be using lib.exe somewhere along the
line in the build process (or is this a red herring?)


Have you considered
devenv.exe /build
?

Marcus
May 7 '06 #3


Bruno van Dooren wrote:
link /OUT:timer.dll /INCREMENTAL /NOLOGO /DLL /DEBUG /SUBSYSTEM:WIND
OWS /IMPLIB:timer.li b /MACHINE:X86 Winmm.lib kernel32.lib user32.lib
gdi32.lib winspool.lib advapi3
2.lib shell32.lib
LINK : warning LNK4001: no object files specified; libraries used
LINK : error LNK2001: unresolved external symbol __DllMainCRTSta rtup@12
timer.dll : fatal error LNK1120: 1 unresolved externals

Whats going on?. I suspect I must be using lib.exe somewhere along the
line in the build process (or is this a red herring?)

at least one problem seems to be that your link command does not take object
files as inputs.
without any object files, the linker only links the lib files, which do not
contain any entry points

If I look at a random link command on my system, it contains a list of
object files to link together.
/OUT:"D:\Project s\Visual Studio
Projects\Tryout Projects\LvArra yTemplate\Debug \LvArrayTemplat e.exe"
/INCREMENTAL /MANIFEST
/MANIFESTFILE:"D ebug\LvArrayTem plate.exe.inter mediate.manifes t" /DEBUG
/PDB:"d:\Project s\Visual Studio
Projects\Tryout Projects\LvArra yTemplate\debug \LvArrayTemplat e.pdb"
/SUBSYSTEM:CONSO LE /MACHINE:X86 kernel32.lib user32.lib gdi32.lib
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
uuid.lib odbc32.lib odbccp32.lib

".\Debug\LvArra yTemplate.obj"

".\Debug\stdafx .obj"

".\Debug\LvArra yTemplate.exe.e mbed.manifest.r es"

If your project links fine when using the IDE, check the buildlog to find
the differences between what the IDE does and what your command line does.


I think you're onto something here Bruno - there appears to be a
difference in the commands used in the log file. Specifically, a .rsp
file is created which I am not doing at the command line:
<BuildLog>

Creating temporary file "c:\timer\Debug \RSP000007.rsp" with contents
[
/Od /D "WIN32" /D "BUILDING_D LL" /D "_WINDLL" /D "_MBCS" /Gm /EHsc /RTC1
/MTd /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /Wp64 /ZI /TP
..\timer.cpp
]
Creating command line "cl.exe @c:\timer\Debug \RSP000007.rsp /nologo"
Creating temporary file "c:\timer\Debug \RSP000008.rsp" with contents
[
/OUT:"Debug/timer.dll" /INCREMENTAL /NOLOGO /DLL /DEBUG
/PDB:"Debug/timer.pdb" /SUBSYSTEM:WINDO WS /IMPLIB:"Debug/timer.lib"
/MACHINE:X86 Winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib
..\Debug\timer. obj
]
Creating command line "link.exe @c:\timer\Debug \RSP000008.rsp"

</BuildLog>
My questions are:

1). What are these .rsp (linker response) files and how may I re-create
them on the command line? - when I run the EXACT command shown in the
buildlog for the compiler, I do not get a message saying that a
temporary *.rsp file is being created - WHY ?
2). How are these .rsp files named? Are the assigned numbers (07 and 08
in the above log - random numbers?)
3). Why is the compiler (cl.exe) using linker options ("/DLL",
"/SUBSYSTEM:WINDO WS", "/MACHINE:X86" etc ?) - are these simply being
passed to the linker?

May 7 '06 #4
Bit byte wrote:
I think you're onto something here Bruno - there appears to be a
difference in the commands used in the log file. Specifically, a .rsp
file is created which I am not doing at the command line:
<BuildLog>

Creating temporary file "c:\timer\Debug \RSP000007.rsp" with contents
[
/Od /D "WIN32" /D "BUILDING_D LL" /D "_WINDLL" /D "_MBCS" /Gm /EHsc
/RTC1 /MTd /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /Wp64 /ZI /TP
.\timer.cpp
]
Creating command line "cl.exe @c:\timer\Debug \RSP000007.rsp /nologo"
Creating temporary file "c:\timer\Debug \RSP000008.rsp" with contents
[
/OUT:"Debug/timer.dll" /INCREMENTAL /NOLOGO /DLL /DEBUG
/PDB:"Debug/timer.pdb" /SUBSYSTEM:WINDO WS /IMPLIB:"Debug/timer.lib"
/MACHINE:X86 Winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib
.\Debug\timer.o bj
]
Creating command line "link.exe @c:\timer\Debug \RSP000008.rsp"

</BuildLog>
My questions are:

1). What are these .rsp (linker response) files and how may I
re-create them on the command line? - when I run the EXACT command shown
in the
buildlog for the compiler, I do not get a message saying that a
temporary *.rsp file is being created - WHY ?
The .rsp file simply contains more command-line options for the linker. You
can simply pile everything on the command line in most cases. There is an
upper limit though - the linker only accepts (IIRC) about 4000 characters on
the command line, so if you're linking a lot of modules it's not too hard to
exceed that limit. That's why the IDE uses the response file to hold the
list of files to be linked - there's no limit on how much stuff you can pile
into a response file.
2). How are these .rsp files named? Are the assigned numbers (07 and
08 in the above log - random numbers?)
For all practical purposes, yes. The name is unimportant - the IDE simply
generates consequtive numbers. The file extension is also unimportant -
there's nothing special about .rsp - it's just a text file.
3). Why is the compiler (cl.exe) using linker options ("/DLL",
"/SUBSYSTEM:WINDO WS", "/MACHINE:X86" etc ?) - are these simply being
passed to the linker?


I don't see those options in the cl command line you've shown above.
Rather, those are being passed to the linker.

-cd
May 7 '06 #5

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

Similar topics

0
2094
by: Alex Lapp | last post by:
Hi ng, i have a problem installing cvs module from: http://www.object-craft.com.au/projects/csv/ My Python version is: Python 2.1.3 (Not the latest, but i need this version for running Zope Application Server) I downloaded the package (csv-1.0) and tried to install with python
5
2793
by: Web Developer | last post by:
Hi, I read that identifiers should not start with an underscore in order to prevent LINKAGE problems. I am not familar with this concept of "linkage", so can someone provide a simple explanation? Thanks in advance WD
47
3876
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
2
1471
by: cpptutor2000 | last post by:
Could some C++ guru please help me? I am using a BigInteger class which is really a wrapper around a C source file(mpi.c) that does arbitrary precision arithmetic operations. When I compile the C file using gcc -g -o mpi mpi.c rng.c -lm there are NO compilation or linking errors. However, when I try to compile the C++ wrapper class using g++ -g -o bigint bigint.C mpi.c rng.c -lm, I get strange linkage problems that all the functions in...
0
1455
by: Louise Caldicott | last post by:
Hi all, I have created a project in Visual Studio which uses satellite assemblies. I have also written a script to build this project from the command line. There seems to be a difference in behaviour when I link the resources via Dev Studio and the command line.
0
1417
by: chandan agarwal | last post by:
hi I have been given the task of building vc++ programs at the command line using make software. i have installed gnu make-3.81 version. i was able to build and run makefiles for turbo c++. but when i tried it for vc++ i faced a lot of problems. i found that vc++ has its own linker link and compiler cl. i am giving u a makefile tht was made for turbo c++. can u tell me what changes to i need to do make in it to make it run at the...
20
6017
by: Aek | last post by:
We recently moved our large codebase over from VS7 to 8 and found that we now get access violations in atexit calls at shutdown when debugging the application in VS2005. This occurs in static members / singletons (especially meyer type singletons) which use locally declared static variables. These variables are normally cleaned up automatically at shutdown of the application by registering with the atexit. I break point the destructor on...
1
2844
by: Tom | last post by:
My unsigned DLL works in my project that references it as long as I set Copy Local = true. Now I have signed the DLL with the sn.exe generated keys but have not yet moved the DLL into the GAC. Can I use a strong named DLL outside the GAC with Copy Local = false by providing a reference to the public key? If yes to above, please tell me how to reference the public key within
0
8792
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
9479
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
9337
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
9266
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
9209
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
6054
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
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2193
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.