Thread: Newbie with minor problem

  1. #1
    Registered User
    Join Date
    May 2002

    Newbie with minor problem

    Ok i just started this morning so please don't laugh at me :P. I am useing Visual Studio 5.0 (97) and the following code thats being a pain is from Lesson 3 of this webpages tutorial:

    My problem is i don't know if its me, or something in C++ thats wrong. Thanks in advance!

    Compiles Fine:

    --------------------Configuration: FirstFor - Win32 Debug--------------------
    Skipping... (no relevant changes detected)

    source.obj - 0 error(s), 0 warning(s)

    Build errors.....:
    --------------------Configuration: FirstFor - Win32 Debug--------------------
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/FirstFor.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

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

    The Code:

    #include <iostream.h> //We only need one header file
    int main() //We always need this
    { //The loop goes while x<100, and x increases by one every loop
    for(int x=0;x<100;x+1) //Keep in mind that the loop condition checks
    { //the conditional statement before it loops again.
    //consequently, when x equals 100 the loop breaks
    cout<<x<<endl; //Outputting x
    return 0;
    Dude, your getting a dell!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Find in your project settings where the type of executable is specified.
    You have many choices, and you chose the wrong one

    > unresolved external symbol _WinMain@16
    This means you're compiling a windows GUI

    > int main() //We always need this
    This means you're actually writing a command line / console / DOS executable (depending on the terminology used by your compiler)

    Just choose a new .exe type and recompile

  3. #3
    Registered User
    Join Date
    May 2002


    i don't really know what type of projects to select for what, i think i picked win32 or something. This is so much different then the vb i am used to, thanks!
    Dude, your getting a dell!

  4. #4
    Registered User
    Join Date
    May 2002
    There is another error in your code:
    for(int x=0;x<100;x+1)
    must be like this:
    for(int x=0;x<100;x++)
    or there will be an infinite loop.

  5. #5
    Registered User
    Join Date
    May 2002
    Yea i realized that when it spat zeros. I changed it to ++ and i got 1 to 99
    Dude, your getting a dell!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getting to grips with allegro and ms vc++ (newbie)
    By jimjamjahaa in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2005, 07:49 PM
  2. Newbie in problem with looping
    By nrain in forum C Programming
    Replies: 6
    Last Post: 11-05-2005, 12:53 PM
  3. Newbie Programmer
    By Extropian in forum C++ Programming
    Replies: 3
    Last Post: 05-18-2004, 01:17 PM
  4. Some help for a newbie?
    By Ilmater in forum C++ Programming
    Replies: 23
    Last Post: 04-19-2004, 07:44 PM
  5. Newbie Game Develpoers Unite!
    By Telenosis in forum Game Programming
    Replies: 10
    Last Post: 06-22-2002, 02:02 PM