Solved

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

Posted on 2004-08-03
3
1,169 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

635 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