LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-09-2004, 01:00 AM   #1
ampex189
Member
 
Registered: Aug 2003
Location: Vancouver, Canada
Distribution: mepis 3.3.1
Posts: 82

Rep: Reputation: 15
newbie in c++


ok, well I feel completely retarted. I am doing a c++ tutorial and the very first program there is in this tutorial is the infamous hello world! I typed it out, saved it as a .cpp file, then I compiled it in g++. my question is how do I run it? I have no idea why I cant run it. oh here is the source for it



Code:
// my first program in C++

#include <iostream.h>

int main ()
{
  cout << "Hello World!";
  return 0;
}
I dont think that I have felt so retarted before.


ampex189
 
Old 04-09-2004, 01:18 AM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
Okay if its compiled you should now have a new program in the directory, to compile it simply type

./programname

You need the ./ since the current directory isn't allowed to execute programs ( security problems if you do ).

The program isn't 100% accurate for c++

Code:
#include <iostream>
using namespace std;
Would be better, I'm really just being picky, as both ways are legal c++, but what I've typed is more standard compilant, which is usually a good habit to get into.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
security newbie, but not Linux newbie. advice on secure delete tools mattie_linux Linux - Security 19 08-15-2005 01:50 AM
Linux semi-newbie and Wine vary newbie geovolt_os1 Linux - Software 4 04-19-2005 11:03 AM
newbie;I am a linux newbie who has installed slackware and have run into a few proble MollyJolly Slackware - Installation 6 06-01-2004 11:21 AM
How To Update To Slackware-Current For a Newbie, By a Newbie :) windsok Slackware 1 09-18-2003 08:53 PM
ipchains newbie. Kernel newbie skeletal29 Linux - Security 3 06-02-2002 03:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration