Start New Discussion within our Software Development Community

I've been trying to compile several C++ tutorial files that include the standard Microsoft header files, such as 'windows.h' to create a basic window. I'm fairly new to this C++ business, but I have a bit of experience with writing console applications on C.

The problem is that the command line compiler keeps throwing the LNK2019 error for every external function I use. I did some searching online and someone mentioned that it was because the function I was trying to use was the prototype but there wasn't a supposed implementation. (They look the same, actually.)

Not entirely convinced, I looked around some more, went back to my tutorial and it said, "Make sure you have specified a Win32 GUI (NOT 'Console') project/makefile/target, whatever applies to your compiler."

I found out that I can compile some of the files using the full-blown Visual Studio. I'm not used to Visual Studio and I think it's clunky and funky.

So is there a way to tell the CL compiler that it's a Win32 app so it'll include the Windows headers and avoid Visual Studio entirely?

Note: the files already include <windows.h>, so that isn't the problem.

Well, thanks anyway, but I found a simple solution to my problem. I wasn't including the user32.lib file as #pragma comment(lib,"user32.lib") Edit: For anybody else struggling with this, you can also include the file as cl myprogra.cpp [b]user32.lib[/b] when using the CL compiler on the command line.


This question has already been answered. Start a new discussion instead.