Thread: Hello World in Windows

  1. #1

    Question Hello World in Windows

    A C++ dosprogrammer who's entering the beautiful world of windowsprogramming (I wanted more memory to my programs) :

    I got Microsoft Visual C++, today and wanted to make the simpliest program in the world: Hello World!

    So I wrote:

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

    int WINAPI WinMain(HINSTANCE hinstance,
    HINSTANCE hprevinstance,
    LPSTR lpcmdline,
    int ncmdshow)
    MessageBox(NULL, "What's up world", "My First Windows Program",MB_OK);

    But the **** wouldn't work, I could compile it, but not build an "exe-file" of it!
    It said:

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

    Ok, probably a verry easy problem, but I'm a newbie in
    Visual C++6, and my world would be a lot easier if someone could help me!

    Rock on!

  2. #2
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Have you set up the correct type of project?

    Looks like the compiler is looking for main() i.e. it is expecting a console application. When you start a new project you need to select win32 application or whatever the option is.

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    VC++ takes a bit of getting used to, as does Win32 programming. If you like, this is about as basic a Win32 "Hello World" as you can do. Look up the API routines in the excellent help. If(when) you get stuck, ask here. Good luck man.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 08:14 AM
  2. how to make a windows application
    By crvenkapa in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2007, 09:59 AM
  3. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  4. Lil Anti Windows Humor
    By RoD in forum A Brief History of
    Replies: 3
    Last Post: 10-02-2002, 12:01 PM
  5. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM