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.
With so little information about the problem, I'm not sure if the previous suggestion was the right one for your case. In simpler debugging cases a scattering of diagnostic print statements can be more appropriate.
Obviously, you have to use your skill and judgement to figure out where to put the print statements and what you want to print out, but you didn't want me to put you out of a job, did you?
And, if you are doing this to learn, you might be wanting to try every approach available to you, just for grins.
Yours was a fair question, and I tried to give you a fair answer.
If you're using an IDE to program C++ (for example, KDevelop or Eclipse on Linux, or Visual Studio on Windows), then you probably first want to learn more about your IDE's debugger.
If you're planning on programming C++ on Linux, then you'll almost certainly be using GCC (either directly, from a command line, or behind a GUI IDE). In this case, the command-line "GDB" is definitely a worthwhile tool to learn.
The *last* thing you want to do is rely on "printf" statements. Using them is inevitable. But there are usually better, more effective ways to debug. The trick is to expose yourself to the higher-level tools available (like GDB or Visual Studio), then fall back on "printf" only when you need to.
Thanks paul boss. But sorry to say that I haven't got the answer. I am using c++ on linux and i just want a command to debug a program.
command filename. I just want the command to debug a filename for errors and execution. Thanks.
I am using c++ on linux and i just want a command to debug a program. like command filename. I just want the command to debug a filename for errors and execution.
If you are expecting a command that you can run that will automagically remove bugs from an incorrectly written bit of code, then you are setting your expectations rather high.
In addition, maybe you should look at static analysis http://en.wikipedia.org/wiki/List_of..._code_analysis which may be closer to what you want. But you will still have work to do; the best that you can expect is that something will point out potential trouble areas and you will have to come up with a way of writing correct code that corresponds to your intentions.
My assumption is that your program is probably a fairly simple one, of the type that you might be set as a learning problem in the early stages of a programming course.