[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1599
  • Last Modified:

Creating a static library from an MFC DLL Project

Is there an easy way to convert an (MFC) Dynamic Link Library into a Static LIB Library???

I have a DLL Project that I need to convert into a Static Link Library...

0
Dak_Programmer
Asked:
Dak_Programmer
1 Solution
 
Shay050799Commented:
just add the CPP and H file to an empty static library project

Shay
0
 
KaplanDaniCommented:
Create a static project and compare the project's setting (code generation, linking ect..) between them. so you'll know what to change.
Dani
0
 
MadYugoslavCommented:
Do the same thing what KaplanDani sad, but You must change include files from that static projrct to Your project.
See the difference in "stdafx.h" file.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
migelCommented:
Hi!
you must remove CWinApp derived objects from your sources to make static library
0
 
Dak_ProgrammerAuthor Commented:
msvcrtd.lib(MSVCRTD.dll) : error LNK2005: _strncpy already defined in libcmtd.lib(strncpy.obj)
msvcrtd.lib(MSVCRTD.dll) : error LNK2005: __setmbcp already defined in libcmtd.lib(mbctype.obj)
LINK : warning LNK4098: defaultlib "mfc42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "mfcs42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "mfco42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "mfcd42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "mfcn42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library

I am getting these errors when I try to compile my test app... any ideas???
0
 
Dak_ProgrammerAuthor Commented:
msvcrtd.lib(MSVCRTD.dll) : error LNK2005: _strncpy already defined in libcmtd.lib(strncpy.obj)
msvcrtd.lib(MSVCRTD.dll) : error LNK2005: __setmbcp already defined in libcmtd.lib(mbctype.obj)
LINK : warning LNK4098: defaultlib "mfc42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "mfcs42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "mfco42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "mfcd42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "mfcn42d.lib" conflicts with use of other libs; use /NODEFAULTLIB:library

I am getting these errors when I try to compile my test app... any ideas???
0
 
migelCommented:
Hi!
you must sets same option for using MFC (first tab in tne lib project settings window) as you use in the project where you want use your lib. Note runtime library settings also must be same (dynamic or static, single/multi threaded)
0
 
Dak_ProgrammerAuthor Commented:
Ok I did that -- but I still get the following warning...


LINK : warning LNK4098: defaultlib "libcd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
0
 
Dak_ProgrammerAuthor Commented:
Ok I did that -- but I still get the following warning...


LINK : warning LNK4098: defaultlib "libcd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
0
 
migelCommented:
Hi!
It seems that compiler Runtime library settings aren`t equal for projects.
0
 
Dak_ProgrammerAuthor Commented:
Ok I got it working -- but when ever I new an object within the static library -- it seems to give me invalid memory
0
 
Dak_ProgrammerAuthor Commented:
Can there be something wrong with doing a new inside a static library
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now