How am I getting this error

This is a discussion on How am I getting this error within the Windows Programming forums, part of the Platform Specific Boards category; How am I getting this error error LNK2001: unresolved external symbol _WinMain@16 I deleted a function prototype in one of ...

  1. #1
    Shadow12345
    Guest

    How am I getting this error

    How am I getting this error
    error LNK2001: unresolved external symbol _WinMain@16

    I deleted a function prototype in one of my headers which I no longer needed, and then I started getting that error. Hmmm

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571

    Re: How am I getting this error

    Originally posted by Shadow12345
    How am I getting this error
    error LNK2001: unresolved external symbol _WinMain@16

    I deleted a function prototype in one of my headers which I no longer needed, and then I started getting that error. Hmmm
    What compiler are you using? Usually when people are writing Win32 app's for the first time they will get that error but with external symbol _main. This is because they are trying to make the Win32 program using a console project in M$VC. So I would assume you don't have WinMain correctly declared or one of your project options got tinkered with?

  3. #3
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    Check out the Forgers programming tutorial, it has FAQ for this kind of question with several solutions:
    http://www.winprog.org/tutorial/index.html

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  4. #4
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753
    read the forger site, but to sum it up its like this:

    you are trying to call a function that is contained in another module other than what modules and libraries you are currently linked to.

    the most common error, said forger's site, is trying to compile a win32 app with a "console project" like sean said.

    or trying to compile a console program and didn't properly write or compile the main() function.

    if you're using VC++ re-create your project with a win32 project, not console.

    if you're using BC++ it says to use -tW however i don't know what thats all about because i use VC++.

    it also said it can happen if you try and compile a BC++ program from the command line and dont specify the correct parameters to tell it that its a win32 app.

    btw, did it run fine before you changed the code?

  5. #5
    Shadow12345
    Guest
    yes it ran fine before i changed my code

    I deleted eveverything except the source workspace and data files and rebuilt the project and that solved the problem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 09:18 PM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 10:15 PM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 02:17 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM

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