Solved

Problem linking object modules : DSTransformer.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE

Posted on 2004-08-03
3
1,119 Views
Last Modified: 2008-03-10
Can some on pl explain wht these errors are about ?
and how can I fix them ?
Code is in the one location and object is present in corresponding ...\Debug directory...

-------------------------------------------------------------------------------------------------------------------------------
DSXMLofstream.cpp
Generating Code...
Linking...
   Creating library Debug/DSAGAPI.lib and object Debug/DSAGAPI.exp
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
StdAfx.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE
DSTransformer.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE
DSView.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE
0
Comment
Question by:adgarcia13
  • 2
3 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11710929
Appears to be a project settings conflict. Maybe you have created a blank project and pasted some code from a different project?
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 11712667
The include file afx.h contains a sequence

#ifndef _AFX_NOFORCE_LIBS

...  include some windows and mfc libs

#ifdef _DLL
      #if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG)
            #pragma comment(lib, "msvcrtd.lib")
      #else
            #pragma comment(lib, "msvcrt.lib")
      #endif
#else
#ifdef _MT
      #if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG)
            #pragma comment(lib, "libcmtd.lib")
      #else
            #pragma comment(lib, "libcmt.lib")
      #endif
#else
      #if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG)
            #pragma comment(lib, "libcd.lib")
      #else
            #pragma comment(lib, "libc.lib")
      #endif
#endif
#endif


// force inclusion of NOLIB.OBJ for /disallowlib directives
#pragma comment(linker, "/include:__afxForceEXCLUDE")

... some other stuff

#endif //!_AFX_NOFORCE_LIBS

You see that  msvcrtd.lib should be included as you have a DEBUG version but the error message above says there is a conflict with 'msvcrt.lib' the RELEASE version of the runtime library.

Maybe you removed _DEBUG macro from the preprocessor settings for Win32 Debug??

Regards, Alex






0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 500 total points
ID: 11712685
The unresolved external is most likely a following error because of the wrong runtime library.

You should also check your Precompiled Header settings. When using stdafx.h as precompiled header file, all your cpp files that are not excluded from precompiled headers must have #include "stdafx.h" as first include statement.

Regards, Alex
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
TTimer no longer functioning 7 85
thread-safe code in c++ 2 84
Exception thrown at 0x00007FFD5BC81F28 7 38
Using Diagnostic tools in VS2015: Unresoved allocations 19 65
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now