Results 1 to 4 of 4

Thread: C++ Programmers

  1. #1

    Default C++ Programmers

    Code:
    #include <windows.h>
    int APIENTRY WinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,
                         int       nCmdShow)
    {
     	
    	MessageBox(NULL, "\tHello World!", "My first windows app", NULL);
    	return 0;
    }
    When I compile the code it says there are 0 errors, 0 warnings.
    When I execute the code it says there are 2 errors.

    --------------------Configuration: main - Win32 Debug--------------------
    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/main.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    main.exe - 2 error(s), 0 warning(s)

    Any guesses on what they could be? I copied the code exactly from this tutorial.

    My compiler is Microsoft Visual C++ 6.0 and yes I have a main.cpp defined (which only contains the code above). This code uses OpenGL to produce a window of some sort. Could it have something to do with my OpenGL drivers or possible lack of? My video card is an ATI RADEON XPRESS 200M with drivers dated 4/11/2005 version 6.14.10.6539.

  2. #2
    ORANGE Dr Unne's Avatar
    Join Date
    Dec 1999
    Posts
    7,394
    Articles
    1
    Contributions
    • Former Administrator
    • Former Developer
    • Former Tech Admin

    Default

    Second result on a google search for "LIBCD.lib fatal error LNK1120: 1 unresolved externals":

    [qq]Windowed applications on Win32 begin at WinMain() while character mode
    applications begin at main(). Apparently you have mistakenly created a
    Windowed project with console application code.[/qq]

    There are many other results which I did not read through.

  3. #3
    Old-Ones Studios Cruise Control's Avatar
    Join Date
    Apr 2005
    Location
    Seattle, WA
    Posts
    3,799

    Default

    This thread takes me back.
    Leave some shards under the belly
    Lay some grease inside my hand
    It's a sentimental jury
    And the makings of a good plan

  4. #4

    Default

    Quote Originally Posted by Dr Unne View Post
    Second result on a google search for "LIBCD.lib fatal error LNK1120: 1 unresolved externals":

    [qq]Windowed applications on Win32 begin at WinMain() while character mode
    applications begin at main(). Apparently you have mistakenly created a
    Windowed project with console application code.[/qq]

    There are many other results which I did not read through.
    That's exactly what I'm trying to do. I'm sick of character black/white appplications. I found what the problem was though. Apparently Windowed applications have to be part of a project while character mode applications don't. I can't just open the code and run it (which is what I was doing).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •