• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Annoying linking error

FortySix&2

n00b
Joined
Mar 29, 2004
Messages
51
Ok for some old reason I cant get any of my new C++ projects to compile. This may be something stupid I'm am missing but i have gotten to frustrated to figure it out. Does anyone have the answer.

Code:
#define WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <windowsx.h>

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow)
{

MessageBox(NULL,"Test", "Test" , MB_OK | MB_ICONEXCLAMATION);

return(0);

}

Error:

Compiling...
Cpp1.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Cpp1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Ok so it is a simple program and It wont link. Is there a setting I am missing or what?

Any input is appreciated.
 
What compiler are you using?


edit: Now that I look at it, it looks like you're using Microsoft Visual Studio 6 or something. So unless I'm overlooking something, I don't know why that doesn't compile, unless you had selected Console Application instead of Win32 Application

edit again: I forgot that the -mwindows flag was about disallowing the command prompt from popping up, so just ignore what I said earlier about that ^_^
 
My bad, Yeah I'm using Visual Studio 6.0.

Basically what i'm doing is starting a new file typing it all in and then compiling it. When I compile it I add it to the workspace and all that good stuff.
 
Well, I only have .NET 2003 installed, so I can't test it, but I believe all you have to do is start a new project, and select Win32 Application instead of console application, and it should work fine.

I could be wrong however. ;p
 
Hey Cverick do you do alot of windows Win32 programming with .NET. I have .NET but havent switched cause I am trying to become pretty adapt in Win32 and DirextX I figured it would be easier with 6.0 becuase thats what the book I am reading recommends (Tricks of Windows Game Programming). Should I screw 6.0 and start using .NET...

See the crappy thing is, in school I was taught to use MFC ugh :(
 
I don't do a lot of Windows programming. I picked up Programming Windows: Fifth Edition by Charles Petzold, and I've been reading through that in my spare time.

I want to learn a lot about it, and become really proficient in it, but I've been dividing my time between learning that and learning COBOL for class, and learning C++ to be a better programmer, so I don't get that much time to mess around with it. 8(

I wish COBOL would die however. =/

edit: To answer your question, if you have a choice, I'd use .NET 2003. 8)
 
Back
Top