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.
Simple enough right? Below is the output I get when I try to compille it. Please help me make since of what it is I need to do to produce C/C++ programs in a Linux Environment.
[wbsmith2@dhcppc1 programs]$ gcc -o hello hello.cpp
In file included from /usr/include/c++/3.2/backward/iostream.h:31,
/usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 184.108.40.206 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
/tmp/ccYveVmw.o: In function `main':
/tmp/ccYveVmw.o(.text+0x14): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/tmp/ccYveVmw.o(.text+0x21): undefined reference to `std::cout'
/tmp/ccYveVmw.o(.text+0x26): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccYveVmw.o(.text+0x2f): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/ccYveVmw.o: In function `__static_initialization_and_destruction_0(int, int)':
/tmp/ccYveVmw.o(.text+0x5c): undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccYveVmw.o: In function `__tcf_0':
/tmp/ccYveVmw.o(.text+0x8b): undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccYveVmw.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
[wbsmith2@dhcppc1 programs]$ ls
that "using namespace std;" is in my c++ book... but I never have to use it. I think it just tells the compiler to look in the "standard" place for the header files.
you're right on with the ./a.out . in the *nix systems, a "." means "current directory" and ".." means next directory up. so if you want to use an executable from your current directory, you do ./ . if you make another directory in there and change into it (cd), you can run that same binary with ../a.out. or, cd back up with cd .. ( or cd ../ to go along with what's stated above)
if you want to just be able to use your programs from anywhere on your system without having to type the full path, you need to put it in /bin, /usr/bin, or anything that gets spit out when you do "echo $PATH". you can also make a directory for only your programs and add that directory to your $PATH variable. open up the file ~/.bash_profile (files and directories w/ a "." in front of them are "hidden"... to see them all when you are in that directory do "ls -a").... also the "~/" means "home directory"... bash understands what you are talking about. this will be /root for the root user and /home/user for any other user.... ooh yeah.. back to $PATH.... open up your ~/.bash_profile, and you'll see a line like PATH=/bin:/usr/bin:, ect.. just put your personal program directory at the end and make sure each of the paths are separated by a colon.
well, have fun!
p.s.- if you have gcc 3.1 (find out with gcc -v) there is a bug in <string.h>, so if you're planing on using that... you should upgrade to gcc-3.2