CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2010
    Posts
    2

    [RESOLVED] Newb Here Getting Linking Code

    I am a programming student that is very out of practice. In fact I have not worked with c++ in over a year and I know I should not have let that happen but with my full course load I really did not get in much practice. I Decided I should get practicing again as after winter break I finally get to return to programming classes. Anyways I decided to go out and start some tutorials on windows programming. And I was trying to compile a simple hello world window.

    here is my tiny bit of code
    #include "stdafx.h"
    #include<Windows.h>

    int WINAPI WinMain (HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nShowCmd)

    {
    MessageBox(NULL,
    L"Hellow World!",
    L"Just another Hello World Program!",
    MB_ICONEXCLAMATION | MB_OK);

    return 0;
    }

    I am unable to build it though
    1>ClCompile:
    1> stdafx.cpp
    1> learntomakeawindow.cpp
    1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
    1>c:\users\jimboslaptop\documents\visual studio 2010\Projects\learntomakeawindow\Debug\learntomakeawindow.exe : fatal error LNK1120: 1 unresolved externals
    1>
    1>Build FAILED.
    1>
    1>Time Elapsed 00:00:01.68
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    So am I missing a library? I would really enjoy to learn what I am doing wrong. Microsoft's site was not to helpful at least the results I read. Thank you guys for your help

  2. #2
    Join Date
    Oct 2009
    Posts
    577

    Smile Re: Newb Here Getting Linking Code

    You did choose the wrong project type. For a windows program you need to choose Win32 application and *NOT* Win32 console application. Better you start again with 'Project New ...'.

  3. #3
    Join Date
    Dec 2010
    Posts
    2

    Re: Newb Here Getting Linking Code

    Thank you so very much.
    Now a feel like a super newbie but I am so this is good. I can get moving forward now

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured