I am a programmer on Linux and find C/C++ support to be very much more complete on Linux than on Windows, but the development tools are pretty different. Usually I use Kate for my text editor, g++ for my C++ compiler, and gdb for my debugger. Not sure if you care, but gdb also has support for frame substitution, which (IMHO) is probably the best feature on any debugger anywhere. I personally prefer the CLI, but if GUI is more your thing there are about a bajillion frontends to GDB, of which nemiver seems to be the prettiest.
I would also read up on autoconf and automake.
To get you up and running, heres the rundown on compiling, debugging, and running a small bit of code.
- Code: Select all
#include <iostream>
using namespace std;
int main(void) {
for (int i=0; i < 5; i++) {
cout << "We meet again!" << endl;
}
return 0;
}
save it as "sillyPirate.cpp".
to compile this simply type:
- Code: Select all
g++ sillyPirate.cpp
which will create an executable in your current working directory named a.out. you can change that behavior by specifying the -o option for g++.
To debug it, you will need debugging symbols- which you will get like so:
- Code: Select all
g++ -g sillyPirate.cpp
then run it through gdb:
- Code: Select all
gdb ./a.out
this will bring you to the gdb prompt. to begin debugging, type "run", which will attempt to run all the way through the program and will give you information about its termination. setting a breakpoint is accomplished by typing "break", followed by a valid symbol or line number. stepping can be done by using the "s" and "n" commands, killing a process is done with "kill", and exiting is done with "exit". There are literally hundreds of more advanced features in GDB, and thousands in GCC, but for now that should suffice to get you started. if you have any problems, let me know.