views:

325

answers:

1

What setting(s) in a Visual Studio 2005 project could cause the build to not add the /dll argument to the linker command line?

Background:

We have a large VC6 project that I'm porting over to VC 2005. This project contains a number of MFC extension DLLs, and I'm running into the following linker warning when I run a build:

warning LNK4086: entrypoint '_WinMainCRTStartup' is not __stdcall with 12 bytes of arguments; image may not run

The reference to _WinMainCRTStartup is highly suspicious, because this is a DLL (which shouldn't have a _WinMainCRTStartup function at all). A search for of the sources indicate that there is no such function defined, so my conclusion is that it it being provided to us by the linker.

Review of the linker.exe command line arguments shows the problem (I've removed full paths for brevity):

/OUT:"Debug\thedll.dll" /INCREMENTAL /MANIFEST /MANIFESTFILE:"Debug\thedll.dll.intermediate.manifest" /DEF:".\thedll.def" /DEBUG /PDB:"\Debug\thedll.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86 version.lib

There is a highly critical command line argument missing: /DLL

If I manually add this argument (using the project properties, Configuration Properties\Linker\Command Line settings), I can get things to compile properly.

But I'm wondering what in the project configuration is causing the /DLL command line setting of linker.exe to be left out?

I've created a temporary project with an extension DLL, and I've done side-by-side comparisons of the .vcproj files, but I can not see any specific settings that would impact this.

EDIT - I've checked the Configuration Properties\General\Project Defaults setting for Configuration Type. It is set to Dynamic Library (.dll)

EDIT2 - Apparently, VS was ignoring the setting until I manually adjusted it. rggggg

A: 

Hi,

The first thing I can suggest is to verify that the project's configuration type is set to Dynamic Library. Right-click the project -> Select Properties -> Select General -> Configuration Type.

Jeremy
thanks - I checked that one already (and added an edit to the OP indicating the correct value)
Kevin Day
I just changed it to EXE for my project, then back to DLL again. Hit apply, and now /DLL appears in the command line. Chalk up 3 hours of wasted time to M$'s poor change handling algorithm in their GUI.
Kevin Day
For reference, here's the MSDN article that describes the /DLL argument and how to set it: http://msdn.microsoft.com/en-us/library/527z7zfs%28VS.71%29.aspx
Kevin Day