Click here to Skip to main content
16,006,475 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalproblem with inline keyword Pin
dart1329-May-04 13:14
dart1329-May-04 13:14 
GeneralRe: problem with inline keyword Pin
bneacetp29-May-04 16:01
bneacetp29-May-04 16:01 
GeneralRe: problem with inline keyword Pin
dart1329-May-04 23:43
dart1329-May-04 23:43 
GeneralRe: problem with inline keyword Pin
Michael Dunn30-May-04 7:48
sitebuilderMichael Dunn30-May-04 7:48 
GeneralRe: problem with inline keyword Pin
toxcct30-May-04 8:29
toxcct30-May-04 8:29 
GeneralRe: problem with inline keyword Pin
Alexander M.,30-May-04 12:26
Alexander M.,30-May-04 12:26 
GeneralRe: problem with inline keyword Pin
dart1331-May-04 4:02
dart1331-May-04 4:02 
GeneralLINK2005... Apparently a Common Linker Problem Pin
jerrycainjr29-May-04 13:06
jerrycainjr29-May-04 13:06 
I have what is according to MSDN and a fairly common problem--so common, in fact, that
a web page has been devoted to not only the problem but also the solution. This page is:

http://support.microsoft.com/default.aspx?scid=kb;en-us;q148652

I am trying to build a managed C++ DLL, and this DLL is designed to consume the LIB
file generated by an unmanaged C++ code base. Both projects use MFC in a shared
DLL, neither uses ATL, and the unmanaged C++ LIB runs just fine when linked against
an unmanaged unit test application. I'm using Visual Studio .NET 2002.

Apparently, the _DllMain@12 symbol is being exported by two .libs, and according to this
article noted above, they are linking in the wrong order. These two libs seem to be the ones
mentioned in the support article above (as generated by the linker output):

------ Build started: Project: <project-name>, Configuration: Debug Win32 ------

Linking...
Processed /NODEFAULTLIB:mfcs70d.lib
Processed /NODEFAULTLIB:MSVCRTD.lib
Processed /NODEFAULTLIB:mfcs70d.lib
Processed /NODEFAULTLIB:MSVCRTD.lib

// output omitted, the above there because I attempt to exclude the two offending
libs and force a link in the correct order...

Found _DllMain@12
Referenced in MSVCRTD.lib(crtdll.obj)
Loaded MSVCRTD.lib(dllmain.obj)

// more omitted, only to arrive at...

mfcs70d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)

The support article insists that the solution (the only viable one in this case, I believe,
since both of system libs) is to exclude MSVCRTD.lib and mfcs70d.lib from the default set
(Project Properties->Linker->Input->Ignore Specific Libraries set to "mfcs70d.lib;MSVCRTD.lib",
without the qoutes), and to re-introduce them in the order I specify (Project Properties->Linker->
Input->Additional Dependencies set to "MyUnmanagedLib.lib mfcs70d.lib MSVCRTD.lib", without
the quotes, the first being my own library, and the order of the second and third being what I think
it needs to be.

In spite of this, it appears from the linker output above that
MSVCRTD.lib is being linked against first. The solution requires that the
MFC lib be linked first, and the C lib be linked afterwards, but I can't seem
to force this.

Any ideas at all? I can only assume that something else is forcing the link order, but
I'm at the end of my wits in trying to figure this out. If it helps, the linker command
line is included below (with the requisite "MyUnmanagedProject" placeholders.)

Any help would be greatly appreciated.
Cheers,
Jerry Cain
jerry@cs.stanford.edu

Linker Command Line:
/VERBOSE /OUT:"Debug/MyManagedLib.dll" /NOLOGO /LIBPATH:"..\MyUnmanagedProject\Debug" /DLL
/NODEFAULTLIB:"mfcs70d.lib" /NODEFAULTLIB:"MSVCRTD.lib" /DEBUG /PDB:"Debug/MyManagedProject.pdb"
MyUnmanagedProject.lib mfcs70d.lib MSVCRTD.lib <two long="" references="" to="" local="" libraries="" of="" my="" own="">
GeneralForce OnSize execution Pin
Anonymous29-May-04 12:51
Anonymous29-May-04 12:51 
GeneralRe: Force OnSize execution Pin
Anonymous29-May-04 14:13
Anonymous29-May-04 14:13 
GeneralRe: Force OnSize execution Pin
Anonymous29-May-04 14:31
Anonymous29-May-04 14:31 
GeneralDock Bar Source Code (like ObjectDock) Pin
puresilence_200229-May-04 10:15
puresilence_200229-May-04 10:15 
GeneralRe: Dock Bar Source Code (like ObjectDock) Pin
Maximilien29-May-04 10:30
Maximilien29-May-04 10:30 
QuestionHow do I test whether a scrollbar exists ? Pin
Still learning how to code29-May-04 9:53
Still learning how to code29-May-04 9:53 
AnswerRe: How do I test whether a scrollbar exists ? Pin
PJ Arends29-May-04 12:40
professionalPJ Arends29-May-04 12:40 
GeneralRe: How do I test whether a scrollbar exists ? Pin
Still learning how to code31-May-04 10:03
Still learning how to code31-May-04 10:03 
GeneralRe: How do I test whether a scrollbar exists ? Pin
PJ Arends31-May-04 11:57
professionalPJ Arends31-May-04 11:57 
GeneralRe: How do I test whether a scrollbar exists ? Pin
Still learning how to code1-Jun-04 2:43
Still learning how to code1-Jun-04 2:43 
GeneralImporting from password protected .xls (I know the password) Pin
GameFaqsPower12329-May-04 9:27
GameFaqsPower12329-May-04 9:27 
Generalcopying bitmap images in memory Pin
hr_phenom29-May-04 8:55
hr_phenom29-May-04 8:55 
GeneralRe: copying bitmap images in memory Pin
PJ Arends29-May-04 12:48
professionalPJ Arends29-May-04 12:48 
GeneralVisual C++ Dll for visual basic Pin
soul.ripper29-May-04 8:25
soul.ripper29-May-04 8:25 
GeneralRe: Visual C++ Dll for visual basic Pin
Deian29-May-04 9:07
Deian29-May-04 9:07 
GeneralRe: Visual C++ Dll for visual basic Pin
soul.ripper29-May-04 14:55
soul.ripper29-May-04 14:55 
GeneralRe: Visual C++ Dll for visual basic Pin
Hesham Amin29-May-04 21:40
Hesham Amin29-May-04 21:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.