Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
The first problem I see is that your using the old header files. The new standard header files do not include the .h at the end. The next error I see is that your not declaring the namespace for the functions cout and endl. Try this code out.
#include <iostream> // notice how it does not have the .h
using namespace std; // this is how you use a namespace
you could also do this:
This is the better way to do as your not using the entire std namespace.
cout << "Hi" << endl;
return 0; // returning anything besides a 0 indicates an error.
it does compile now.......... I write:
g++ test.c -o me.out
and it will create me.out
but I type me or me.out and it keeps saying:
bash: me.out: command not found
but the file is there I see it with ls
I can compile now!
thanks a lot to everyone.......... why do I have to use a ./ in front of the file?
I'm used to C++ under Windows..... but I don't know whats about *.out files...... if I try to write something a little more complicated (ie I use several .h and .cpp files) how can I join them into one exe?
thanks thanks thanks a lot I really appreciate it.
i would suggest that u try using ./
first of all,try to get the object file as it is,i.e compile using the basic command
no g++ -o..... etc.
if the compiling went fine(as u have told)
u should be able to find a file a.out in your directory.
now type ./a.out to run the program.
now why to use ./ in front............
from what i have heard,object files are executed using the ./ command in front of the name of the file.(try to get output atleast usiong this)
now to run several cpp files together,from what i have heard
it is enough to compile them together.
g++ file1.cpp file2.cpp .................
(please reconfirm on this and post the answer)