'Hello world' won't compile (Solved)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
leonixyz
Posts: 11
Joined: Wed 29 Jun 2011, 18:22

'Hello world' won't compile (Solved)

#1 Post by leonixyz »

I'm very newbie and this Lucid Puppy 525 full hard drive installation is my first experience with Linux, please be patient by answering me.
I mean to have installed the devx sfs correctly (the make command gives me output!).
I downloaded and installed an IDE named Eclipse but didn't work, it gives the following error: "there is no /gcc/ or /gpp/ folder".
Now i wrote this .cpp file in /root/

Code: Select all

	#include <iostream.h>
	using namespace std;
	main()
	{
		cout << "Hello World!";
		return 0;
	}
and I'm trying to compile it with make and get my "Hello World!" output.
This is what's happens in my shell:

Code: Select all

#make -f hello.cpp
hello.cpp:2: *** commands commence before first target. Stop.
What should I do?

Thank you.
Giulio

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

cpp

#2 Post by vovchik »

Dear leonixyz,

What may you want is this:

Code: Select all

//#include <iostream.h>
   //using namespace std;
   //main()
   //{
      //cout << "Hello World!";
      //return 0;
   //}
#include <iostream>;
using namespace std;

int main(){
       cout << "Hello world !\n";
       return 0;
}
and compile as follows:

Code: Select all

g++ -o hello hello.cpp
With kind regards,
vovchik

User avatar
leonixyz
Posts: 11
Joined: Wed 29 Jun 2011, 18:22

#3 Post by leonixyz »

thank you very much!
problem solved :)

Post Reply