Computer Science Canada

Error while making .exe

Author:  Schaef [ Tue Sep 21, 2004 5:36 pm ]
Post subject:  Error while making .exe

I keep getting this error when trying to make my .exe file:

Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/hi.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

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


This is all i am doing for the coding

code:
#include <iostream>
using namespace std;

int main(void)
{
        cout << "Hi" ;
        return 0;
}


ne ideas on why i am getting this error??

Author:  bugzpodder [ Tue Sep 21, 2004 5:45 pm ]
Post subject: 

it seems that you are trying to compile under VC++6... see if this works. just copy the contents, and start a new file (no projects) and paste it into the file. compile (the compiler should ask you for a new project/workspace, etc)

Author:  Andy [ Tue Sep 21, 2004 7:19 pm ]
Post subject: 

well my guess is the same wit bugz's except u are returning a value while ur main function is void... that mite do something... also make sure the last run window is closed before you compile... sometimes it screws it up

Author:  wtd [ Tue Sep 21, 2004 7:47 pm ]
Post subject: 

His main function returns int. The "void" in there indicates that the function takes no arguments.

Author:  Andy [ Tue Sep 21, 2004 8:17 pm ]
Post subject: 

fo shizzle? i thought if u had void inside the arguments, u dont need to return a value... hmm o wells, i usually juss do void func()

Author:  wtd [ Tue Sep 21, 2004 8:31 pm ]
Post subject: 

code:
return_type function_name(argument_type argument_name)


And a "function" which doesn't return anything is a procedure.

If you want to be strict, functions return values, but don't change non-local variables. Procedures don't return a value, but they can change whatever they want. Functions can be called from within procedures, but procedures can't be called from functions.


: