Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Can't even get the pre-made HelloWorld to work
Can't even get the pre-made HelloWorld to work [message #1095418] Tue, 27 August 2013 03:11 Go to next message
Johnson Joe is currently offline Johnson Joe
Messages: 5
Registered: August 2013
Junior Member
So, first let me just say I've used Eclipse for Java for several years, but now that I'm trying to get to learn C++, it's all confusion.

I went ahead and installed all the packages I need from MinGW, and went through the Eclipse help topic about setting up, building, and running the example HelloWorld program.

There aren't any errors or anything, but when I run it, the Console goes straight to terminated, I don't see anything print.

I'm just so confused. There's a lot more stuff to do to get a simple program running than I'm used to from Java.
Re: Can't even get the pre-made HelloWorld to work [message #1097304 is a reply to message #1095418] Thu, 29 August 2013 14:11 Go to previous messageGo to next message
Dale Fernandes is currently offline Dale Fernandes
Messages: 1
Registered: August 2013
Junior Member
Dear Johnson Joe

One should normally provide the code for problems as it is now impossible to see where you could've gone wrong, lucky it is a simple task and can be accomplished like so:

//A header that includes I don't know what but it does seem to be required as it is in every newly created document Smile
#include "stdafx.h"

//Provides standard input output methods
#include <iostream>

//Allows the calling of functions within the iostream (As far as I know this is how it works)
using namespace std;

int main()
{
//Outputs Hello world! to the console. the "endl" function moves the cursor to the next line.
cout << "Hello world!" << endl;

//Prevents the console from self-terminating and presents the user with the "Press any key to continue..." scenario.
system("PAUSE");

//Returns a value of 0 which normally means the program executed successfully.
return 0;
}
Re: Can't even get the pre-made HelloWorld to work [message #1098079 is a reply to message #1095418] Fri, 30 August 2013 15:30 Go to previous message
Marc-Andre Laperle is currently offline Marc-Andre Laperle
Messages: 171
Registered: July 2009
Senior Member
Try adding the MinGW bin path to the PATH env variable, typically C:\MinGW\bin. See
http://www.eclipse.org/forums/index.php/t/197552/
Previous Topic:Eclipse RDT server crashes with read timed out
Next Topic:Ant in Eclipse C++ Bundle
Goto Forum:
  


Current Time: Tue Sep 16 04:59:17 GMT 2014

Powered by FUDForum. Page generated in 0.01761 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software