Solved

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C Language combined operators 28 120
Websocket through haproxy reused connection causes "Not a valid frame" error. 4 125
Unable to start eclipse ? 17 161
How do i run a c++ file? 15 51
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

679 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