Help!!: Visual C++ 6.0 (Windows Programming(5th edition))

  • 12 years ago

    Can anybody help?  Recently I have got hold of a book called "Programming Windows(fifth edition) by C Petzold".  I have downloaded prgorams from the companion CD of the book and tried to comiple and build them.  I have got MS Visual C++ 6.0 on my Windows XP computer.  I have no problem with compiling them but, when I try to build them, Visual C++ 6.0 generates the following error message:


       Linking ...

       LIBCD.lib(crt0.obj):error LNK2001:unresolved external symbol _main

       Debug/HelloWin.exe:fatal error LNK1120:1 unresolved externals

      Error executing link.exe

    Do I get this error message because the system on my computer is XP?  What shold I do?  I did not forget to add all the library objects as instructed by the book!

    I will really appreciate it if any of you guys can give me some idea or solution!!

    Best regards



  • 12 years ago

    Hi Chong,

    => Generally (from MSDN):
    Code references something (such as a function, variable, or label) that the linker can't find in the libraries and object files.

    => But for 'main' unresolved external :

    ** Check the followings :

    1. If you are using Unicode in your project :

    • In VC++6 : 'Project' menu ->'Settings...' -> in 'Link' tab -> choose 'Output' in category combobox -> in 'Entry-point symbol', add 'wWinMainCRTStartup' (without ''). 
    • In VC++.NET : 'Project' menu -> 'Project Properties...' -> 'Configuration Properties'   -> 'Linker' -> 'Advanced' -> add 'wWinMainCRTStartup' (without '') to 'Entry Point' field.

    2. Maybe you are choosing an incorrect type of project, e.g. 'Win32 Project' instead of 'Win32 Console Application'.

  • 12 years ago

    Dear Mohammad 

    You have got it right. It has turned out to be that it is to do with unicode. Many thanks for helping me once again.

    Best rgards




Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Java is to JavaScript what Car is to Carpet.” - Chris Heilmann