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





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\LvArrayTemplate.exe" /INCREMENTAL /MANIFEST /MANIFESTFILE:"Debug\LvArrayTemplate.exe.intermediate.manifest" /DEBUG /PDB:"d:\Projects\Visual Studio Projects\TryoutProjects\LvArrayTemplate\debug\LvArrayTemplate.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.res"

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?

.



Relevant Pages

  • Re: Regarding symbol resolving in VxWorks
    ... whole compilation units, i.e., object files. ... libraries/archives. ... partial linker rules are being used and the linker decides it cannot know ... In above command, app.c is my application, libtest.a is my library. ...
    (comp.os.vxworks)
  • Re: How to list objects files in an executable
    ... try runnng the nm command (the name nm stands for "name" - since it ... all the object files linked into this executable. ... source files that were used. ... This is a signature virus. ...
    (comp.unix.programmer)
  • problems applying property pages in VC2005
    ... I'm having some problems applying the property pages ... to a project the project does'nt generate any object files. ... Creating temporary file ... Creating command line "link.exe ...
    (microsoft.public.vc.ide_general)
  • Re: static GtkAda
    ... > the libs below (let's say libz) to the beginning of the list the ... previously undefined symbol, AFAIK. ... references in libraries listed later in the command line cannot be ... resolved by object files that have already been skipped. ...
    (comp.lang.ada)
  • Re: Modules and ld command
    ... > an initialization function, I don't think the final module can have ... > multiple initialization functions. ... > multiple object files with ld, but those object files wouldn't be ... I would have thought that ld command above would have allow to avoid ...
    (comp.os.linux.development.system)