C++ Beginner

edited June 2005 in Internet & Media
Hi there guys, i just started c++ today, i got a book on it. I followed everything the book told me to do, i can compile it, and it opens up and shows my stuff in the visual c++ thing, but if i try to compile it as a release, and open the exe file it shutdowns right away and i cant see it. Will i learn something later on that will make it so it doesnt shut down when i open it? Or am i doing something wrong. If you need any info, ask me.

Comments

  • NosferatuNosferatu Arizona
    edited May 2005
    post the code here so we can see what's wrong.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited May 2005
    and please tell us what you're trying to do with the program.
  • edited May 2005
    Its just a simple first program, opens up a dos prompt and says Hello all your happy people. But whenever it opens it shuts down instantly unless i compile it and run it through the c++. Heres the code
    /* '01 Main.cpp' */
    
    /* Input output stream header file */
    #include <iostream> (theres iostream over here but doesnt show in the post)
    
    /* Start */
    int main ()
    {
    	std::cout << "Hello all you happy people" << std::endl;
    	return 0;
    }
    
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited May 2005
    try going to start -> run.

    type cmd

    this brings up the command prompt (excuse me if you already know all of this)

    navigate to the executable using cd (change directory)

    try running it by typing in the name.



    basically it looks fine, but when you run it, windows closes the output window before you can see that it's working. using the command prompt allows you to see the output.
  • edited May 2005
    Oh okay, so im not doing anything wrong because it shuts down right?
  • mmonninmmonnin Centreville, VA
    edited May 2005
    Yes you are fine.


    If you want you can put 'system("pause");' after the cout and it will wait for a key to be entered. I use that quite often in my labs so my teacher and look at my output.
  • edited May 2005
    Alright, i got the pause thing in there, when i compile it and send it to my friend he cant open it, says the program is not configured right.
  • mmonninmmonnin Centreville, VA
    edited May 2005
    Can you run the .exe yourself? I use Visual Studio.net for C++ and the .exe is in the debug folder. I dont do a release copy, I just debug it.
  • edited June 2005
    Sorry about the delay in my response, been busy. To answer your question, yes i can run the EXE myself, i have tried the release folder, and the debug folder, i have zipped the entire thing, and send it to my other PC and it gives me an error. This is the exact error that it tells me.
    C:\Documents and Settings\Owner\Desktop\Test\Mathematical Operators.exe
    
    This application has failed to start because the application configuration is incorrect.  Reinstalling the application may fix this problem.
    
  • edited June 2005
    You might want to check for 64-bit protability issues between machines.

    This is assuming you are using .net visual C++

    Good Luck
Sign In or Register to comment.