Linking to library problems.

Posted on 2004-11-29
Last Modified: 2009-12-16
I am trying to put some resources and C++ files into a library so that I can easily add this library to mulitiple MFC projects.

After adding the library to my solution, and moving the files accordingly, I get the message:

error LNK2001: unresolved external symbol __CorExeMain@0

upon linking of the MFC project. I don't have "CorExeMain" anywhere in my project.. it must be a VS thing.

Both the library I've created and my MFC project  depend upon a second library (codejock library)
Could this be causing the problem?

My MFC project is set as the "Single Startup Project" and is set to be the "Application (.exe)" type. My library and codejock library are set as "Static Library (.lib)" type.

I've re-built several times. Any sugestions would be most appreciated.

Thank you!
Question by:JoyBurke
    LVL 30

    Expert Comment

    Sounds like you're missing a *.lib file from your linking command.

    Check the documents for your codejock library, and see what *.lib files have to be added to your project.

    Author Comment

    There are only two libraries that need to be added -- and I've added them both.

    Why do you think it is missing a lib file? Do you understand that error message?
    LVL 86

    Assisted Solution

    Are you sure your project contains mscoree.lib?

    Author Comment

    Well, it compiled and linked just fine before I added the new library I created to the solution.

    Where should I look for mscoree.lib?
    LVL 30

    Accepted Solution

    >>Well, it compiled and linked just fine before I added the new library I created to the solution.

    Look at your new library requirements.  The linker error is indicating your missing a library.

    Exactly what is the new library?
    LVL 17

    Expert Comment


    Author Comment

    jkr - Adding mscoree.lib allowed it to link, but caused failures at run time.

    Axter - the library was a .Net class library. I guess this was the wrong thing to create.

    To fix my problem, I created instead a MFC DLL project and change the type to a .lib.

    Thank you both for your suggestions.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    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…
    IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    779 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

    21 Experts available now in Live!

    Get 1:1 Help Now