- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When converting a large mixed Fortran/C++ project from DVF 6.6 to Intel VFC, I get the following error during the link:
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in LIBCMTD.lib(dllmain.obj)
I believe I have followed the solution mentioned in http://support.microsoft.com/default.aspx?scid=kb;en-us;148652 but it doesn't help.
Here are the particulars:
The c++ Lib options:
/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_MBCS" /FD /EHsc /RTC1 /MTd /YX"stdafx.h" /Fp".Debug/T700Win.pch" /Fo".Debug/" /Fd".Debug/" /W3 /nologo /c /ZI /TP
The Fortran options:
/nologo /Zi /Od /include:"Debug/" /warn:declarations /iface:cvf /module:"$(INTDIR)/" /object:"$(INTDIR)/" /traceback /check:bounds /libs:static /threads /dbglibs /c
The Fortran Linker options:
/OUT:"c:cdsTrace700T700SimIntel.dll" /INCREMENTAL /NOLOGO /NODEFAULTLIB:"msvcrt.lib libcmtd.lib Nafxcwd.lib" /DEBUG /PDB:"$(OUTDIR)/T700SimIntel.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"$(OUTDIR)/T700SimIntel.lib" /DLL c: race700 racedata6x.lib c:Trace700TraceExtDLL6x.lib c: race700ViewerDll6x.lib
An example of one of the C++ routines:
#include "forcelib.h"
#include
#include
unsigned long callback_function = 0L;
_declspec ( dllexport )
void __stdcall SetCallback(long cb)
{
if (cb != 0L)
callback_function = cb;
}
void UseCallback(int pctdone, int status)
{
if (callback_function)
{
((void (__stdcall *)(int *, int *))callback_function)(&pctdone, &status);
}
}
Thanks for any insight!
Larry Scheier
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in LIBCMTD.lib(dllmain.obj)
I believe I have followed the solution mentioned in http://support.microsoft.com/default.aspx?scid=kb;en-us;148652 but it doesn't help.
Here are the particulars:
The c++ Lib options:
/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_MBCS" /FD /EHsc /RTC1 /MTd /YX"stdafx.h" /Fp".Debug/T700Win.pch" /Fo".Debug/" /Fd".Debug/" /W3 /nologo /c /ZI /TP
The Fortran options:
/nologo /Zi /Od /include:"Debug/" /warn:declarations /iface:cvf /module:"$(INTDIR)/" /object:"$(INTDIR)/" /traceback /check:bounds /libs:static /threads /dbglibs /c
The Fortran Linker options:
/OUT:"c:cdsTrace700T700SimIntel.dll" /INCREMENTAL /NOLOGO /NODEFAULTLIB:"msvcrt.lib libcmtd.lib Nafxcwd.lib" /DEBUG /PDB:"$(OUTDIR)/T700SimIntel.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"$(OUTDIR)/T700SimIntel.lib" /DLL c: race700 racedata6x.lib c:Trace700TraceExtDLL6x.lib c: race700ViewerDll6x.lib
An example of one of the C++ routines:
#include "forcelib.h"
#include
#include
unsigned long callback_function = 0L;
_declspec ( dllexport )
void __stdcall SetCallback(long cb)
{
if (cb != 0L)
callback_function = cb;
}
void UseCallback(int pctdone, int status)
{
if (callback_function)
{
((void (__stdcall *)(int *, int *))callback_function)(&pctdone, &status);
}
}
Thanks for any insight!
Larry Scheier
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error finally went away when I changed the Fortran Runtime Library setting from "Debug Multithread" to "Debug Multithread DLL"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting. Given the C++ and Fortran options you show I would not expect this, though I see that you have "gummed the works" by adding /nodefaultlib linker options. I suspect they are at least partly responsible for the problem.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page