473,385 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.lib /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 __DllMainCRTStartup@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 4955
link /OUT:timer.dll /INCREMENTAL /NOLOGO /DLL /DEBUG /SUBSYSTEM:WIND
OWS /IMPLIB:timer.lib /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 __DllMainCRTStartup@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:\Projects\Visual Studio
Projects\TryoutProjects\LvArrayTemplate\Debug\LvAr rayTemplate.exe"
/INCREMENTAL /MANIFEST
/MANIFESTFILE:"Debug\LvArrayTemplate.exe.intermedia te.manifest" /DEBUG
/PDB:"d:\Projects\Visual Studio
Projects\TryoutProjects\LvArrayTemplate\debug\LvAr rayTemplate.pdb"
/SUBSYSTEM:CONSOLE /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\LvArrayTemplate.obj"

".\Debug\stdafx.obj"

".\Debug\LvArrayTemplate.exe.embed.manifest.re s"

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**********************@hotmail.com
Remove only "_nos_pam"
May 7 '06 #2
Hi Bit byte

"Bit byte" <fl**@flop.com> 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.lib /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 __DllMainCRTStartup@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.lib /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 __DllMainCRTStartup@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:\Projects\Visual Studio
Projects\TryoutProjects\LvArrayTemplate\Debug\LvAr rayTemplate.exe"
/INCREMENTAL /MANIFEST
/MANIFESTFILE:"Debug\LvArrayTemplate.exe.intermedia te.manifest" /DEBUG
/PDB:"d:\Projects\Visual Studio
Projects\TryoutProjects\LvArrayTemplate\debug\LvAr rayTemplate.pdb"
/SUBSYSTEM:CONSOLE /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\LvArrayTemplate.obj"

".\Debug\stdafx.obj"

".\Debug\LvArrayTemplate.exe.embed.manifest.re s"

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_DLL" /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:WINDOWS /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:WINDOWS", "/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_DLL" /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:WINDOWS /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 ?
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:WINDOWS", "/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
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...
5
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...
47
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
2
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...
0
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...
0
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...
20
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...
1
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. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.