Solved

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

Posted on 2004-08-03
3
1,149 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

734 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