Unresolved External Symbol

This is a discussion on Unresolved External Symbol within the C++ Programming forums, part of the General Programming Boards category; Here's a good one for you all. I'm making a very (VERY) simple Win32 application that is supposed to display ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313

    Unresolved External Symbol

    Here's a good one for you all. I'm making a very (VERY) simple Win32 application that is supposed to display a message box. And it won't. I know good and well that <windows.h> is the header to use when using MessageBox(), so I'm getting REALLY confused.

    Code:
    #include <windows.h>
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
    	MessageBox(NULL, "Test", "Test", MB_OK);
    
        return(0);
    }
    Yes, the linker is set /SUBSYSTEM:WINDOWS. I checked that one already. The error is:

    main.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function _WinMain@16
    Help?

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,670
    that's odd - what compiler are you using?



    ITSA
    Socket Library!

  3. #3
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Visual Studio 2005 Beta WITH the Core SDK installed and referenced in the compiler.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,670
    you might try re-installing it - it appears the linker is confused.



    ITSA
    Socket Library!

  5. #5
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Reinstalling didn't work - but.

    It appears that the Core SDK is moronic and the "Register PSDK Directories with Visual Studio" command does not work. YAY.

    *tries something*

    Nope. Even telling the compiler manually that the includes are at X and libs are at Y didn't work. Hello complete loss of ideas.

  6. #6
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,801
    Get a different compiler?
    Woop?

  7. #7
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Ok.. what is your suggestion for a Visual Studio 6-like IDE using compiler that's more standards-compliant than Visual Studio 6?

  8. #8
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,801
    Well I personally love Dev-C++ because its free and its awesome . If you want a sorta vc++ fell you could go for minGW developer studio.
    Woop?

  9. #9
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Ok, so we'll try Dev-C++. Why not, right?

  10. #10
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,652
    MessageBox() is in user32.lib so you have to link with it.
    If it still doesn't work make sure the search path for libraries includes the directory that contains user32.lib.

    gg

  11. #11
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    I had done that, actually, according to Microsoft's instructions (How to use the SDK with Visual Express 2005 Beta). *shrugs*

    Using Dev-C++ now. Thank you for all the help, though!

  12. #12
    Karsten
    Join Date
    Sep 2004
    Posts
    8
    checked it with Dev-C++ and it works perfect

    Hoschi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM
  5. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 02:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21