4
$\begingroup$

About me: I started development in python. I consider my self as an intermediate Vim user. I am comfortable with many bash shell commands. For all the python projects (like django or numerical optimization related), I simply open multiple terminals in i3 and then edit different files using vim and get things done.

Here is a fact about me, I have never done project development in C++ ( long back I did write some single source code file in C, but that is all). I would like to develop some expertize in doing C++ based project development using command line interface (no IDE for sure). I know that there will be an addition compiling and linking overhead (this is where python is so good).

I need to learn some tools which will allow me which help me to create good workflow ( or say environment ) to do development of C++ based projects using cli (command line interface). I suspect that the 3 tools which are must for me to create such cli (terminal) based workflow are :

  • a compiler ( gcc)

  • gdb for debugging via command line

  • make ( for build automation)

Can anyone refer me to a book ( or any other resource like online courses, videos, blogs ) which would help me to learn those tools for building a terminal based workflow and would teach me some C++ language itself ?

Note1: Most of the C++ books I found online would simply teach C++ development using some IDE, I have not found a single book which teaches C++ development using make and gdb (or any other command line tools).

$\endgroup$
3
  • 2
    $\begingroup$ Welcome to Computer Science Educators I suspect that such a resource doesn't exist. Educational materials tend to go the easy way and use the IDE so that the students can focus on the language, not the workflow. Developing a CLI workflow is probably more of a personal preference than a standard to disseminate. $\endgroup$ Commented Aug 24, 2019 at 20:58
  • $\begingroup$ Your requirements seem inconsistent. You want "terminal based" but also "tools". If I suggest emacs you will hate me, of course. $\endgroup$
    – Buffy
    Commented Aug 24, 2019 at 21:59
  • $\begingroup$ @Buffy why should this be inconsistent? There are command line tools as well... $\endgroup$
    – csabinho
    Commented Aug 24, 2019 at 22:37

3 Answers 3

3
$\begingroup$

For make consider O'Reilly book. It is a perfect intro. Honest to goodness.

The GDB one is not so much an educational tool, it is a reference, but I doubt you'd find anything which would teach you how to use GDB any better. The GDB learning curve is short and easy.

I also doubt that there is a resource dedicated to gcc any better than the online documentation.

As for the C++ language I strongly recommend the foundational classics by Stroustrup (try Principles and Practice for starters and see how it goes).

PS: your request seems to be well aligned with another classic. Never mind it was published in 1984. Still very much applicable.

$\endgroup$
4
$\begingroup$

Do it in two steps: There are resources for each part.

  • Start by learning how to compile, link, run code, and launch the debugger, from the command line.
  • Then learn how to write make files.

You should also read Recursive Make Considered Harmful by Peter Miller. It should direct you away from a lot of common bad practice. When I applied what I learnt from it, to re-right a make file, with the intention to make it simpler, so that it would be easier to add to. It also became twice as fast (but that is not the reason to read this).

$\endgroup$
2
$\begingroup$

This answer is based on the assumption that you are a competent programmer, but want to improve your C++ and learn how to design and write larger scale programs. I find the best way to start is to imitate something existing. This means reading code. Another tool you didn't mention, but which will be part of a project, is for source code control (likely git).

As a learning tool for understanding C++ development I would suggest that you find an open source c++ project on a topic of some interest to you. You don't have to contribute to the project, but simply use it as a guide on how large scale projects are structured.

Down load the source per the instructions and practice "building" the project. Now you are ready to study the structure of the project. It is likely made up of many files, distributed over a number of directories. Each logical piece may have a Makefile associated with it controlled by higher level Makefiles. Begin by examining the directory and file structure and understanding how it was decomposed into pieces. You don't have to understand every piece, but rather get a feel for the overall structure. Of course this is only the structure the authors came to use and may be different for other projects. Things to notice are whether the structure places headers and source in the same or different directories and whether the .o are in separate directories. Are .o files linked into libraries or used directly? Look for the Makefiles and study how they are structured to build things based on the actual structure. You many find that the project may be built in different ways (e.g. debuggable or optimized, etc). Study how those choices are reflected in the Makefiles. You will likely be doing a lot of reading of manuals for Make and reading answers in stackoverflow.

Projects will likely contain resources for testing a build. Study the methodologies used and how they are incorporated into the project. They are also likely to contain the means to distribute a "new" version, either as source or as a binary. Again, study the options and try to understand the processes involved.

If you are looking for advanced C++, you could look at the Boost sources and understand what they did in building various C++ libraries.

As you begin to understand projects, take ideas and apply them to something you want to work on. Begin small and add ideas as you learn. Study other projects in the same way to become familiar with other arrangements. You goal is to learn what techniques to employ in various situations so that you can choose what is appropriate for your work.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.