Thread: linker error with a simple menu program in visual studio c++ express 2010

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    2

    Red face linker error with a simple menu program in visual studio c++ express 2010

    Hello,



    Will somebody please help me debug this problem? I've gone over my code several times. I'm following an instructors video, and can't find any difference between my and his code, but we are using different versions of visual studio. So, here's my error:

    LINK : error LNK2001: unresolved external symbol _mainCRTStartup



    here's my main file:


    << untagged, unindented code snipped >>


    this is a simple console program that creates a menu to store and access future work for a c++ class.



    I apologize for the lack of comments. My professor chose to "black-box" some of the code, because we haven't learned what it means yet. However, I know that the MenuLab class contains two public methods. Addmenu adds a menu based on the input of the main file. the runMenu() method creates menu items and cout's it.



    the runSelection method allows you to open the menu item, "I think".



    thanks,

    Scott
    Last edited by srt0422; 08-27-2010 at 09:57 PM.

  2. #2
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    LINK : error LNK2001: unresolved external symbol _mainCRTStartup
    Uh, I'd say make sure your project matches what you're compiling to. ie, MSVC is going to complain if your project is set to Console Application but you have a WinMain() instead of main(). Likewise, it will fail if the project is Windows but you have a main().

    So check that setting (it's under Project Properties) and if all else fails, try a new project, and pick "empty project" as the template.
    I'm sure the code is fine, however unreadable it may be (read: CODE tags, please!!!)
    Consider this post signed

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    2

    many thanks

    I appreciate your direction and advice.

    It turns out that the problem was very simple. The name for my headerfile was the same as the names of one of my classes and a couple of my files and a folder. All I had to do was rename my header file with _H at the end. Even when I wrote the header definition in all caps, it wouldn't work until I changed the name itself.

    Thanks for that link too. I was wondering how to do that. Different sites seem to have different methods for blocking off text.

    SCott

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  2. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM
  3. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM
  4. Using 'if' with char arrays or string objects
    By c++_n00b in forum C++ Programming
    Replies: 36
    Last Post: 06-06-2002, 09:04 PM
  5. <list>
    By Unregistered in forum C++ Programming
    Replies: 9
    Last Post: 02-24-2002, 04:07 PM

Tags for this Thread