[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1031
  • Last Modified:

Linking to library problems.

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!
2 Solutions
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.
JoyBurkeAuthor Commented:
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?
Are you sure your project contains mscoree.lib?
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!

JoyBurkeAuthor Commented:
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?
>>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?
JoyBurkeAuthor Commented:
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.


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now