Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 09-11-2005
emoly emoly is offline
Registered User
 
 
Join Date: Mar 2005
Posts: 12
Send a message via MSN to emoly
-->
Unhappy Link error when adding MFC header in dll project

Hi,
We build a dll lib with ICE 2.1.0 and VC6.0. Now a MFC messagebox needs to be added in this dll lib. But once we inlude <afxwin.h>, the dll project can't be compiled.
The error is:
--------------------Configuration: Netids_Connect - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
Netids_Connect.cpp
QueryServer.cpp
QueryServerFactory.cpp
Generating Code...
Linking...
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in Netids_Connect.obj
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in MSVCRTD.lib(MSVCRTD.dll)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in msvcprtd.lib(delop_s.obj)
nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in Netids_Connect.obj; second definition ignored
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in MSVCRTD.lib(MSVCRTD.dll); second definition ignored
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in msvcprtd.lib(delop_s.obj); second definition ignored
Creating library Debug/Netids_Connect.lib and object Debug/Netids_Connect.exp
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
nafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype
Debug/Netids_Connect.dll : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
Creating browse info file...

Netids_Connect.dll - 9 error(s), 3 warning(s)

How can I resolve this problem? Is it anything uncomportable between ice stlport and VC6.0?

Thank you!
__________________
LiuYing
National Research Center for Intelligent Computing Systems(NCIC)
Institute of Computing Technology
Chinese Academy of Sciences
http://www.ncic.ac.cn

Our project's name is still in borning, but we call our system DBroker.
Reply With Quote
  #2 (permalink)  
Old 09-12-2005
ffmpeg4nmm's Avatar
ffmpeg4nmm ffmpeg4nmm is offline
Registered User
 
Name: Smart Song
Organization: fastreaming network multimedia Ltd.
Project: CDMA
 
Join Date: Jun 2005
Posts: 11
What's your MFC run-time library?
try to change it to "Debug Multithreaded DLL",if not!
Reply With Quote
  #3 (permalink)  
Old 09-12-2005
emoly emoly is offline
Registered User
 
 
Join Date: Mar 2005
Posts: 12
Send a message via MSN to emoly
-->
I have used /MDd option
The MFC run-time library is "C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB".
When I change above directory to the top of VC library files, the error is less than before.
Linking...
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in Netids_Connect.obj
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in Netids_Connect.obj; second definition ignored
Creating library Debug/Netids_Connect.lib and object Debug/Netids_Connect.exp
Debug/Netids_Connect.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

Netids_Connect.dll - 2 error(s), 1 warning(s)
__________________
LiuYing
National Research Center for Intelligent Computing Systems(NCIC)
Institute of Computing Technology
Chinese Academy of Sciences
http://www.ncic.ac.cn

Our project's name is still in borning, but we call our system DBroker.
Reply With Quote
  #4 (permalink)  
Old 09-12-2005
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,418
Did you look at the other MFC demos that are included with the Ice distribution and their build flags?
Reply With Quote
  #5 (permalink)  
Old 09-12-2005
emoly emoly is offline
Registered User
 
 
Join Date: Mar 2005
Posts: 12
Send a message via MSN to emoly
-->
I have seen those demos and I use the same flags as them.
There is something different between dll and obj. If I use mfc to create obj, it's OK. But if I use mfc to create dll, the link error will happen.

What's wrong with the dll or what especial configuration is needed by dll project?
__________________
LiuYing
National Research Center for Intelligent Computing Systems(NCIC)
Institute of Computing Technology
Chinese Academy of Sciences
http://www.ncic.ac.cn

Our project's name is still in borning, but we call our system DBroker.
Reply With Quote
  #6 (permalink)  
Old 09-12-2005
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,418
I'm not sure, but this doesn't appear to be anything Ice specific.
Reply With Quote
  #7 (permalink)  
Old 09-12-2005
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 2,013
A search on Google gave me this link on the Microsoft web site:

http://support.microsoft.com/default...;en-us;q148652

It looks very similar to your problem!
Reply With Quote
  #8 (permalink)  
Old 09-12-2005
emoly emoly is offline
Registered User
 
 
Join Date: Mar 2005
Posts: 12
Send a message via MSN to emoly
-->
Talking

Hi,
I find something possible to cause the link problem. It is maybe wrong use of _USRDLL and _AFXDLL together.

_USRDLL:compiling regular DLLs that statically link to MFC
_AFXDLL:compiling regular DLLs that dynamically link to MFC

The latter is what we need, so remove _USRDLL in the preprocessor definitions.
Now ,compling is OK. I hope the project will work too.

I'm so sorry to trouble you.

Thank you all for your help very much!
__________________
LiuYing
National Research Center for Intelligent Computing Systems(NCIC)
Institute of Computing Technology
Chinese Academy of Sciences
http://www.ncic.ac.cn

Our project's name is still in borning, but we call our system DBroker.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
slice2cpp header renaming with header-ext tctimmeh Help Center 2 03-28-2009 04:07 PM
Project : error PRJ0019: A tool returned an error code: "Performing Custom Build Step Falagard Help Center 6 04-11-2004 09:12 PM
Ice Php 1.0.2 link error fengxb Help Center 12 03-09-2004 12:08 AM
link error: error LNK2001: unresolved external symbol __imp___assert gmueckl Help Center 2 09-03-2003 02:49 AM


All times are GMT -4. The time now is 12:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2010 ZeroC, Inc.