Re: C++ debug/release builds and project references



jetan@xxxxxxxxxxxxxxxxxxxx ("Jeffrey Tan[MSFT]") wrote:

I have following questions to your problem:
1. Is your class library in configuration "Release"?
2. How do you add reference in the Winform project? Do you add the class
library dll in "Projects" tabpage(this is what I used in the test projects)
or browse to the ManagedClassLib.dll directly and add it as reference? I
suspect if you add the ManagedClassLib.dll in the debug folder.

I have also attached my sample test project in this reply. You may download
it through Outlook Express (not IE). You may give it a rebuilding on your
side and see if the "BuildLog.htm" still has this problem. Thanks.

Hi Jeffrey,

Thanks for the quick reply.

I'm not sure I understand your first question - the class library is
in configuration "release" when I have set the solution to release.

I added the reference in the projects tab page.

I downloaded your sample onto my machine and built it. However, before
building anything I changed the configuration to "Debug", since it
opened set to "Release". When I built the debug build, it failed when
it tried to reference the release dll. Output is below.

When I closed and reopened the solution, it built debug correctly -
which was what it was set to when it opened. If I then switch to
release, it builds, but refers to the debug dll.

Maybe I have something set strangely? You mentioned Ctrl+Shift+B to
build - I do F7 or select Build->Rebuild Solution - Ctrl+Shift+B
doesn't do anything for me.

Output from first build, with configuration set to debug:

Creating temporary file
"c:\tmp\ManagedWinform\ManagedClassLib\Debug\RSP000001.rsp" with
contents
[
/Od /AI "C:\tmp\ManagedWinform\ManagedWinform\Debug" /D "WIN32" /D
"_DEBUG" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MTd /GS /Yu"stdafx.h"
/Fp"Debug/ManagedClassLib.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c
/Zi /clr /TP /FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /Zl
..\ManagedClassLib.cpp
..\AssemblyInfo.cpp
]
Creating command line "cl.exe
@c:\tmp\ManagedWinform\ManagedClassLib\Debug\RSP000001.rsp /nologo"
Creating temporary file
"c:\tmp\ManagedWinform\ManagedClassLib\Debug\RSP000002.rsp" with
contents
[
/Od /AI "C:\tmp\ManagedWinform\ManagedWinform\Debug" /D "WIN32" /D
"_DEBUG" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MTd /GS /Yc"stdafx.h"
/Fp"Debug/ManagedClassLib.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c
/Zi /clr /TP /FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /Zl
..\Stdafx.cpp
]
Creating command line "cl.exe
@c:\tmp\ManagedWinform\ManagedClassLib\Debug\RSP000002.rsp /nologo"
Creating command line "rc.exe /fo"Debug/app.res" .\app.rc"
Creating temporary file
"c:\tmp\ManagedWinform\ManagedClassLib\Debug\RSP000003.rsp" with
contents
[
/OUT:"C:\tmp\ManagedWinform\ManagedWinform\Debug\ManagedClassLib.dll"
/INCREMENTAL /NOLOGO /DLL /DEBUG /ASSEMBLYDEBUG
/PDB:"C:\tmp\ManagedWinform\ManagedWinform\Debug/ManagedClassLib.pdb"
/FIXED:No /noentry nochkclr.obj mscoree.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 "\Program
Files\Microsoft Visual Studio .NET 2003\Sdk\v1.1\Lib\mscoree.lib"
..\debug\AssemblyInfo.obj
..\debug\ManagedClassLib.obj
..\debug\Stdafx.obj
..\debug\app.res
]
Creating command line "link.exe
@c:\tmp\ManagedWinform\ManagedClassLib\Debug\RSP000003.rsp"

Output Window


Compiling...
Stdafx.cpp
Compiling...
ManagedClassLib.cpp
AssemblyInfo.cpp
Generating Code...
Compiling resources...
Linking...
nochkclr.obj : warning LNK4099: PDB 'libc.pdb' was not found with
'c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\lib\nochkclr.obj' or at
'C:\tmp\ManagedWinform\ManagedWinform\Debug\libc.pdb'; linking object
as if no debug info

Results


Build log was saved at
"file://c:\tmp\ManagedWinform\ManagedClassLib\Debug\BuildLog.htm"
ManagedClassLib - 0 error(s), 1 warning(s)


------- Build started: Project: ManagedWinform, Configuration:
Debug|Win32 -------

Command Lines


Creating temporary file
"c:\tmp\ManagedWinform\ManagedWinform\Debug\RSP000004.rsp" with
contents
[
/Od /AI "C:\tmp\ManagedWinform\ManagedWinform\Debug" /D "WIN32" /D
"_DEBUG" /D "_MBCS" /FD /EHsc /MTd /GS /Yu"stdafx.h"
/Fp"Debug/ManagedWinform.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c
/Zi /clr /TP /FU
"c:\tmp\managedwinform\managedwinform\release\ManagedClassLib.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
/FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
..\Form1.cpp
..\AssemblyInfo.cpp
]
Creating command line "cl.exe
@c:\tmp\ManagedWinform\ManagedWinform\Debug\RSP000004.rsp /nologo"
Creating temporary file
"c:\tmp\ManagedWinform\ManagedWinform\Debug\RSP000005.rsp" with
contents
[
/Od /AI "C:\tmp\ManagedWinform\ManagedWinform\Debug" /D "WIN32" /D
"_DEBUG" /D "_MBCS" /FD /EHsc /MTd /GS /Yc"stdafx.h"
/Fp"Debug/ManagedWinform.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c
/Zi /clr /TP /FU
"c:\tmp\managedwinform\managedwinform\release\ManagedClassLib.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
/FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"
/FU "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
..\stdafx.cpp
]
Creating command line "cl.exe
@c:\tmp\ManagedWinform\ManagedWinform\Debug\RSP000005.rsp /nologo"

Output Window


Compiling...
stdafx.cpp
stdafx.cpp(0) : fatal error C1192: #using failed on
'c:\tmp\managedwinform\managedwinform\release\ManagedClassLib.dll'

Results


Build log was saved at
"file://c:\tmp\ManagedWinform\ManagedWinform\Debug\BuildLog.htm"
ManagedWinform - 1 error(s), 0 warning(s)

regards

Andrew Rowley
--
Andrew Rowley
.



Relevant Pages

  • Re: Reference per configuration
    ... I can't define reference for a specific ... >> the "Debug" configuration I use Nunit for testing, ...
    (microsoft.public.dotnet.framework)
  • Re: Linking Errors .....any one plz help
    ... > Its a COM dll that i generated and tested using debug configuration ... Typically, you have a build step after the DLL has been built successfully, ... select regsvr32.exe as your command ...
    (microsoft.public.dotnet.languages.vc)
  • Command line arguments ignored
    ... I am developing a C++ project and want to pass some command line ... the configuration is set ... to Debug and I entered my argument list in Project -> Project ... I misunderstand the settings in the properties window. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Reference per configuration
    ... I can't define reference for a specific ... > configuration. ... > is under #if NTEST definition. ... The NTEST declared only in Debug ...
    (microsoft.public.dotnet.framework)
  • Reference per configuration
    ... I can't define reference for a specific ... the "Debug" configuration I use Nunit for testing, ...
    (microsoft.public.dotnet.framework)

Loading