Compiler Error

This is a discussion on Compiler Error within the C++ Programming forums, part of the General Programming Boards category; Hi all....so I'm a C++ noob and I'm trying to test some things I've learned, but am getting a compiler ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    Compiler Error

    Hi all....so I'm a C++ noob and I'm trying to test some things I've learned, but am getting a compiler error message I have no clue how to fix.

    Here's the error message:

    1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
    1>P:\C++\Projects\General_Template\Debug\General_T emplate.exe : fatal error LNK1120: 1 unresolved externals
    here is the code being compiled in Visual C++ 2008 Express Edition

    Code:
    // Program1 - A "Sandbox" of sorts
    // to practice C++ in 
    #include <cstdio>
    #include <cstdlib>
    #include <iostream>
    using namespace std;
    
    //Prototype Declarations
    void WelcomeMessage(void);
    void ExitMessage(void);
    
    int main(int nNumberofArgs, char* pszArgs[])
    {
    	// Display greeting
    	void WelcomeMessage(void);
    	
    	//woo more code goes here
    	
    	
    	// Display Exit Message
    	void ExitMessage(void);
    	
    	system("PAUSE");
    	return 0;
    }
    
    void WelcomeMessage(void)
    {
    	cout << "Welcome, this is my first practical program.\n"
    		 << "IDFK what it does quite yet, but we'll see \n"
    		 << "Have a jolly good day, man \n"
    		 << endl;
    	return;
    }
    
    void ExitMessage(void)
    {
    	cout << "Later, dude! \n"
    		 << endl;
    	return;
    }

    I appreciate any help.

    Cheers

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    13,007
    You need to set up your project to make a command line program, not a Windows program.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Posts
    5,453
    >> void ExitMessage(void);

    You don't call a function the same way it's defined.

    Code:
    int add( int lhs, int rhs )
    {
    	return lhs + rhs;
    }
    
    int main( void )
    {
    	int value = add( 3, 4 );
    }
    Code:
    int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000
    <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan
    (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000
    )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}

  4. #4
    Registered User
    Join Date
    Jun 2009
    Posts
    3
    Between the two of you I figured it out.
    Thanks

  5. #5
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,681
    Quote Originally Posted by Chasethesunset View Post
    Hi all....so I'm a C++ noob and I'm trying to test some things I've learned, but am getting a compiler error message I have no clue how to fix.

    Here's the error message:

    1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
    1>P:\C++\Projects\General_Template\Debug\General_ T emplate.exe : fatal error LNK1120: 1 unresolved externals
    Not that it really matters that much, but that's a linker error, not a compiler error.
    I used to be an adventurer like you... then I took an arrow to the knee.

  6. #6
    Registered User
    Join Date
    Jun 2009
    Posts
    3
    Quote Originally Posted by hk_mp5kpdw View Post
    Not that it really matters that much, but that's a linker error, not a compiler error.
    Oh well, that's good to know anyways. I just called it a comp error cause I got it when I built the solution.

    Thanks again for the help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 03:35 PM
  2. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  3. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  4. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09:43 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM

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