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?