I have started using Redhat Linux i would like to know how to use Gcc to program in Linux.
Also i would like to know how i can access:
C
C++
Boost
GTK+
Libraries in Linux... i saw them getting installed when i installed Linux on my System.
Please Help!!
views:
109answers:
7Regarding the gcc part
For the C/ C++ part, write a C or C++ program and compile it (using gcc). Then run it. Know you can tell your friends that you have access to C and/or C++
If I were in your situation, this is probably what my Google search history would look like:
- package management redhat
- linux programming environment
- simple c++ tutorial linux
- using gcc
- boost introduction
- gtk tutorial c
- and so on
I can't really give a better answer than that...
I'm sorry to disappointed, as it seems like you were expecting a (Menu>Menu>Run C/C++) kind of answer.
What are C, C++, GTK+, Boost
I think there's a misunderstanding here, C, C++, GTK+, Boost are not programs in the sense that you can find an icon, double click, and have a nice graphical window.
They are programming languages/libraries that one interacts with - primarily through the command line.
How do I find out if I have them?
For C & C++ : Type in your unix command line gcc --version
. If you get a response with a version, you have it.
For GTK+ and Boost : Rather than trying to search your system to find them I'd recommend simply downloading them from their respective websites and putting them into your development environment yourself. You're going to need to do your homework here.
How to I use/interact with them?
Through the command line by writing up the files, compiling, and running them. Optionally you can find yourself an IDE of the suitable language and interact that way.
How can I get started?
I'd recommend starting out small. GTK+ and Boost are libraries - and using libraries is something you'd do once you've gotten acquainted with your programming language of choice. So, start out small, learn some C, some C++ (and how they differ), and figure out where you'd like to go from there.
Is it worth it?
Yes! C/C++ is IMO the most valuable language you can learn for the sake of learning programming languages. Java is also great to learn. In terms of productivity and getting things done, the languages to learn are currently Ruby or Python (or for more web-aimed stuff, PHP).
- First choice : IDE vs no IDE
IDE under linux : code::blocks, eclipse, netbeans, ... Also, dedicated editor (emacs, kate, vim, ...) are fine too. Install it by you local package manager (I think it's rpm)
No IDE : using GCC from the command line, or creating makefile.
Some useful commands :
gcc MySourcefile.c -o MyExecutable -lMyLibraryName # for C
g++ MySourcefile.cpp -o MyExecutable -lMyLibraryName # For C++
- Libraries
Usually found in your local package manager, but can be build manually. In this case, check library README or INSTALL file.
Usually you'll do something like this:
g++ myawesomeprogram.cpp -o myawesomeexecutablename -l BoostLibNameHere -l GTKLibNameHere
But you will also need the headers and libraries installed for development. You should rummage through the list of Red Hat RPMs for more information.
Hi Strut, I feel you are doing it first time on linux, in *NIX environment while programming anything it will not make everything readily available as in MS IDE, so you need to compile, link properly by guiding the compiler and linker with appropriate options. e.g. if you are compiling you must show the include path suppose the prog name is a.cxx
gcc -c a.cxx -I<paths of all your header files> -I<paths of all your header files>... -I <> < Followed by Compiler flags>
gcc -o a.exe -L<libraries which contains the definition of all your called functions> -L <libraries which contains the definition of all your called functions> -Wl,<Linker options> -Wl,<> <Flags for Linker>
This way you will be able to finish your compilation-> linking to final executable. If you are still getting the error please paste the error here I can help you for that perticular error, which may be a file inclusion or linker error.
Best Regards
-Brijesh