[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

More MFC Linker Errors in VC++4.0 (LNK2005)

Posted on 1997-08-05
1
Medium Priority
?
843 Views
Last Modified: 2013-11-20
I am having fits trying to link the simplest MFC app.

First of all, I can't get even an AppWizard-generated shell of a program to link dynamically using the mfc40d.dll. So, I
can't try some of the suggestions others have made to do
this in order to solve my LNK2005 problems. I would prefer
to link dynamically, if I could.

Here is the error I get, running with /verbose:lib and with
the included libraries of - mfc40d.lib msvcrtd.lib
3dPlusd.lib, in that order. No excluded libs.:

=== begin linker output ===
Linking...
LINK : LNK4073: cannot create map for .ILK file; linking
nonincrementally

Searching Libraries
    Searching H:\MSDEV\MFC\lib\mfc40d.lib:
    Searching H:\MSDEV\LIB\msvcrtd.lib:

LINK : error : Internal error during Pass1
link.exe terminated at user request.
test2.exe - 1 error(s), 0 warning(s)
=== end linker output ===


Next, I tried to link statically. This worked for my AppWizard
tiny program - a single TextOut statement in the view window.
But, when I tried to remove some classes, and insert some code
into CMyApp::InitInstance(), I get the LNK2005 errors.

Below is a sample, linked with included libraries
nafxcwd.lib libcmtd.lib 3dPlusd.lib (in that order), and
by *Ex*cluding mfc40d.lib and msvcrtd.lib.:

=== begin linker output ===
Linking...
LINK : LNK4073: cannot create map for .ILK file; linking
nonincrementally

Searching Libraries
    Searching H:\MSDEV\MFC\lib\nafxcwd.lib:
    Searching H:\MSDEV\LIB\libcmtd.lib:
    Searching h:\3dGraphics\3DPLUS\LIB\3dPlusd.lib:
    Searching H:\MSDEV\LIB\kernel32.lib:
    Searching H:\MSDEV\LIB\user32.lib:
    Searching H:\MSDEV\LIB\gdi32.lib:
    Searching H:\MSDEV\LIB\comdlg32.lib:
    Searching H:\MSDEV\LIB\winspool.lib:
    Searching H:\MSDEV\LIB\advapi32.lib:
    Searching H:\MSDEV\LIB\shell32.lib:
    Searching H:\MSDEV\LIB\comctl32.lib:
    Searching H:\MSDEV\LIB\OLDNAMES.lib:
    Searching H:\MSDEV\MFC\lib\mfc40d.lib:
mfc40d.lib(MFC40D.DLL) : error LNK2005: "protected: static struct
AFX_MSGMAP const  CWnd::messageMap"(?messageMap@CWnd@@1UAFX_MSGMAP@@B)
already defined in nafxcwd.lib(wincore.obj)
mfc40d.lib(MFC40D.DLL) : error LNK2005: "public: static struct
CRuntimeClass
CObject::classCObject"(?classCObject@CObject@@2UCRuntimeClass@@A)
already
defined in nafxcwd.lib(objcore.obj)
mfc40d.lib(MFC40D.DLL) : error LNK2005: "public: static struct
CRuntimeClass
CFileException::classCFileException"(?classCFileException@CFileExcepti
on@@
2UCRuntimeClass@@A) already defined in nafxcwd.lib(filex.obj)
    Searching H:\MSDEV\MFC\lib\mfcs40d.lib:
    Searching H:\MSDEV\LIB\msvcrtd.lib:
msvcrtd.lib(MSVCR40D.dll) : error LNK2005: ___threadhandle already
defined
in libcmtd.lib(tidtable.obj)

LINK : error : Internal error during Pass1
link.exe terminated at user request.
test2.exe - 5 error(s), 0 warning(s)
=== end linker output ===


This is my first foray with an MSVC version > 2.0, after a
couple of years of UNIX development. I have looked at the other
posts regarding this (or similar) problem(s), and tried the
suggestions - no success. I've also tried suggestions I found
in Books Online, shipped with MSVC, also no help. What am I
doing wrong? I hear that people actually *do* create apps
and make money using MSVC, right? I'm wondering how right now.

Sorry this post is long, but I believe in being thorough.

Please help.

Matthew Walker
0
Comment
Question by:matsaleh
[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
1 Comment
 
LVL 4

Accepted Solution

by:
mbhakta earned 200 total points
ID: 1303139
This could be due to several reasons :
- Disk space .
- Clash between two libraries viz libc . libcmt or msvcrt.
- This could be also due to some corruption of obj files.

If the above things don't work tell me which version of VC++ are you running ?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

650 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