473,789 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Static MFC in DLL (linker error)

Hi
I want to use the static MFC within a dll, but I get the following errors
when linking:
nafxcwd.lib(app core.obj) : error LNK2001: unresolved external symbol ___argv

nafxcwd.lib(app core.obj) : error LNK2001: unresolved external symbol ___argc

nafxcwd.lib(app help.obj) : error LNK2001: unresolved external symbol
__mbctype

nafxcwd.lib(fil elist.obj) : error LNK2001: unresolved external symbol
__mbctype

nafxcwd.lib(vie wedit.obj) : error LNK2019: unresolved external symbol
__mbctype referenced in function "protected: long __thiscall
CEditView::OnFi ndReplaceCmd(un signed int,long)"
(?OnFindReplace Cmd@CEditView@@ IAEJIJ@Z)

When I specifiy _AFXDLL in the preprocessor settings the project compiles
correctly, but on program execution, the MFC71D.dll is still required, as
when using the shared dll mfc.

I tried to solve the problem by using /NODEFAULTLIB: nafxcwd.lib (as it was
described in an previous thread), but then I even get more errors.

Does somebody have an idea?

thanks
Alex
Nov 17 '05 #1
3 8117
http://support.microsoft.com/default...;EN-US;Q148652

--
---------------------------------------------------
Automate your software builds with Visual Build Pro
http://www.visualbuild.com/

"ac2806" <ac****@onemail .at> wrote in message
news:43******** **************@ newsreader.inod e.at...
Hi
I want to use the static MFC within a dll, but I get the following errors
when linking:
nafxcwd.lib(app core.obj) : error LNK2001: unresolved external symbol
___argv

nafxcwd.lib(app core.obj) : error LNK2001: unresolved external symbol
___argc

nafxcwd.lib(app help.obj) : error LNK2001: unresolved external symbol
__mbctype

nafxcwd.lib(fil elist.obj) : error LNK2001: unresolved external symbol
__mbctype

nafxcwd.lib(vie wedit.obj) : error LNK2019: unresolved external symbol
__mbctype referenced in function "protected: long __thiscall
CEditView::OnFi ndReplaceCmd(un signed int,long)"
(?OnFindReplace Cmd@CEditView@@ IAEJIJ@Z)

When I specifiy _AFXDLL in the preprocessor settings the project compiles
correctly, but on program execution, the MFC71D.dll is still required, as
when using the shared dll mfc.

I tried to solve the problem by using /NODEFAULTLIB: nafxcwd.lib (as it
was described in an previous thread), but then I even get more errors.

Does somebody have an idea?

thanks
Alex

Nov 17 '05 #2
Thanks for the link, but as I wrote before, when I try to ignore the lib
(nafxcwd.lib) by specifying it in "Properties/Linker/Input/Ignore Specific
Libraries", it get even more linker errors.
I also tried to add msvcrtd.lib but this also didn't help.

Any futher suggestions?
"Kyle Alons" <re***@to.newsg roup> wrote in message
news:u$******** ******@TK2MSFTN GP09.phx.gbl...
http://support.microsoft.com/default...;EN-US;Q148652

--
---------------------------------------------------
Automate your software builds with Visual Build Pro
http://www.visualbuild.com/

"ac2806" <ac****@onemail .at> wrote in message
news:43******** **************@ newsreader.inod e.at...
Hi
I want to use the static MFC within a dll, but I get the following errors
when linking:
nafxcwd.lib(app core.obj) : error LNK2001: unresolved external symbol
___argv

nafxcwd.lib(app core.obj) : error LNK2001: unresolved external symbol
___argc

nafxcwd.lib(app help.obj) : error LNK2001: unresolved external symbol
__mbctype

nafxcwd.lib(fil elist.obj) : error LNK2001: unresolved external symbol
__mbctype

nafxcwd.lib(vie wedit.obj) : error LNK2019: unresolved external symbol
__mbctype referenced in function "protected: long __thiscall
CEditView::OnFi ndReplaceCmd(un signed int,long)"
(?OnFindReplace Cmd@CEditView@@ IAEJIJ@Z)

When I specifiy _AFXDLL in the preprocessor settings the project compiles
correctly, but on program execution, the MFC71D.dll is still required, as
when using the shared dll mfc.

I tried to solve the problem by using /NODEFAULTLIB: nafxcwd.lib (as it
was described in an previous thread), but then I even get more errors.

Does somebody have an idea?

thanks
Alex


Nov 17 '05 #3
Change In "Configrati on property "->"C/C++"->"Code Generation"->"RunTime
Library" to Multi-threaded (/MT)

Hope it will solve your problem
Mar 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
6200
by: Mark A. Gibbs | last post by:
I have a question about mixing C and C++. In a C++ translation unit, I want to define a function with internal linkage and C calling convention. Here's a sample of what I want to do: // main.cpp // This is defined in a C module extern "C" void fake_qsort(void*, std::size_t, std::size_t, int (*compare)(const void*, const void*));
4
5841
by: Scott | last post by:
We are trying to build a managed C++ static link library containing several classes which are members of a namespace. The build of this library seems to work OK. No errors. We then try to use this library in a managed C++ application and get the following linker error. LINK : error LNK2020: unresolved token (06000002) TestLib.TestClass::GetTemp LINK : fatal error LNK1120: 1 unresolved externals A verbose build listing shows that the...
3
1614
by: pauldepstein | last post by:
Sorry in advance if this message sounds imprecise but it's difficult to be precise when you don't really understand what's going on. I have a class called Parameters. The default constructor Parameter:Parameter() contains various values such as interest = 0.05; My intent is for the user to be able to override these defaults so I have a function void Parameter::set(void) . This is supposed to give the user a chance
3
5121
by: Charles Nicholson | last post by:
Hello all- I have some static C++ libraries that I wrote in VS2003 but which upgraded fine when i went to VS2005 Pro. In them i overload the global versions of operators new, new, delete, and delete. I also use the STL and parts of boost (shared_ptr<> and weak_ptr<>) pretty heavily. They have dependencies on various windows libs (dbghelp, winsock, etc...). These static libraries have no common runtime support at all and use the...
4
2356
by: DaTurk | last post by:
Hi, I've noticed that when trying to create a managed, auto_gcrooted variable in a antive class, the compiler throws linker exceptions. While searching some forums I found out that this is a bug? I couldn't find the work around, just numerous references to the fact there is one. But apparently there are issues as to how to destroy said objects. Can anyone shed some more light on this topic for me? It would be much appreciated.
14
2583
by: Jeroen | last post by:
Hi all, I've got a question about writing a library. Let me characterize that library by the following: * there is a class A which is available to the user * there is a class B that is used in severel 'underwater operations' * there is a list which stores objects of class B There are several issues I'm not sure about:
5
1491
by: parag_paul | last post by:
Can a class with out any instances present have it static members updated. If yes, on which object does the update happen. -Parag
1
9924
by: Jaco Naude | last post by:
Hi, I'm using a static library in my application which links fine except for a few global variables. The static library only contains a bunch of .cpp and .h files and the global variables are defined as follows: extern unsigned mgl_numg, mgl_cur; extern float mgl_fact; extern long mgl_gen_fnt; extern short mgl_buf_fnt;
17
8386
by: Juha Nieminen | last post by:
As we know, the keyword "inline" is a bit misleading because its meaning has changed in practice. In most modern compilers it has completely lost its meaning of "a hint for the compiler to inline the function if possible" (because if the compiler has the function definition available at an instantiation point, it will estimate whether to inline it or not, and do so if it estimates it would be beneficial, completely regardless of whether...
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6761
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.