Thread: Need some Help Please !!

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    7

    Unhappy Need some Help Please !!

    Hi Everybody, I am new to this programming side. I Like to learn about c++. I found an simple tutorial to make trough c++. I wrote the codes correctly. When i compile there is no errors. But when i execute .exe [CTRL+F5] there are 2 errors. does any body have any solution for these errors?

    I am using Microsoft Visual C++ 6.0
    OS - Windows XP Professional Service pack 3

    This is the code what i am working with
    Code:
    // my first program in c++
    
    #include <iostream>
    using namespace std;
    
    int main ()
    {
    	cout << "Hello World!/n";
    	cout << "I'm a C++ Programer";
    	return 0;
    
    }

    This is the message which appears when i compile it.

    --------------------Configuration: Learning - Win32 Debug--------------------
    Compiling...
    Skipping... (no relevant changes detected)
    1st.cpp

    1st.obj - 0 error(s), 0 warning(s)

    This the message which appears when i execute the .exe file.

    --------------------Configuration: Learning - Win32 Debug--------------------
    Linking...
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/Learning.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    Learning.exe - 2 error(s), 0 warning(s)
    does any body have any idea about this ?
    I am glad to see a solution for this.

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    Does your exe build ok in the log though? Force a rebuild and check the messages at that stage, Have you compiled, built and run any other programs with this IDE, I imagine not given the code content, but any success using other environments? Check your project linking options also.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    7
    no. it doesnt build. it stops with those errors. this error comes now when executing the exe.

    --------------------Configuration: Learning - Win32 Debug--------------------
    Linking...
    LINK : fatal error LNK1104: cannot open file "kernel32.lib,"
    Error executing link.exe.

    Learning.exe - 1 error(s), 0 warning(s)
    Last edited by shehantissera; 02-25-2011 at 03:16 AM.

  4. #4
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    Really this is a google job:

    google search results
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  5. #5
    Registered User
    Join Date
    Feb 2011
    Posts
    7
    I googled about this like about a day.. but still not reasonable solution. thats why i tried to post this problem on this website.

  6. #6
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    So you checked all the project linking options etc? Are you on a 64 bit machine? What is the OS? There is a lot of help in those goole search links, What did you try from those and what was the result of those steps?
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  7. #7
    Registered User
    Join Date
    Feb 2011
    Posts
    7
    I checked almost every thing on google search results.. but no solution still.
    I am running Windows 7 . in it VMware and inside it is Windows xp professional 32bit.

    I went around the linking options. but i cant find a way to correct this. do you have any idea please??

  8. #8
    Registered User
    Join Date
    Feb 2011
    Posts
    7
    I checked almost every thing on google search results.. but no solution still.
    I am running Windows 7 . in it VMware and inside it is Windows xp professional 32bit.

    I went around the linking options. but i cant find a way to correct this. do you have any idea please??

  9. #9
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    I'm sorry i cant help any further as this is not an issue i have ever had, and if it were me i would have googled and tried that way, after doing my usual project build checks, I beleive this to be a system specific issue, ie your machine so i would do standard troubleshooting tests like write a new project and test that, test your installation package on a different machine, reinstall the IDE if it has never worked before, install a different IDE like codeblocks and test with that to see if anything at all can be made to build and run on your OS and hardware,
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  10. #10
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    You created a Win32 application, not a Win32 Console application.

    Under Project->Properties->Configuration Properties->Linker->System change SubSystem from Windows to Console.

  11. #11
    Registered User
    Join Date
    Feb 2011
    Posts
    7
    i am using Microsoft Visual Studio 6.0. There is no thing like that under project.
    There is a option called settings. but still there is no option called Configuration Properties > Linker..... etc..

  12. #12
    Registered User
    Join Date
    Feb 2011
    Posts
    7
    Yes i have choosen Win32 application..

  13. #13
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Well I certainly don't have a 10+ year old version of Visual Studio lying around to find the correct settings for you, so experiment. You don't want the Win32 Application, you want a Console application.

  14. #14
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Upgrade to Visual Studio 2008/2010. Then repeat the steps outlined.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Tags for this Thread