Tools a C++ programmer may need

Pages: 123
What tools, apart from the IDE (which may be installed or online), the debugger within it and version control system like git do you use as a C++ programmer, please?
What tools generally do you suggest? Please also mention their names so that I can use them.

Valgrind is pretty useful. It's default memory debugger (memcheck) is very useful for finding memory leaks and invalid memory usage (similar to memory sanitizers in modern compilers). It's profiler (callgrind + kcachegrind) can also be useful (and very interesting) to estimate where the program spends most of its time so that you know where you should focus your optimization effort if things are too slow.
grep. It can, very quickly, scan a large code base for key terms and display a wad of surrounding lines for you to see how something was used, or where it was used, and so on. Standard on unix, its available for windows.

A smarter text editor. Your needs, your choices. For me, microsoft for some unholy reason took out their macros (not c++ macros, this is IDE macros that record keystrokes for playback) and notepad ++ still has them, so I use N++ for those needs. MS still has rectangle selection, but I require a tool with that as well (where you can select text in a pure rectangle and only get part of the line and also edit multiple lines at once with an elongated cursor).

A hex editor. There as SO many, picking one is user's choice really. These let you examine binary files that you wrote for correctness easily, or to look at one you have to read to see if the spec and the file actually match, what byte order it uses, and so on.

I find I have always needed a good image editor with a set of hard to get features: I want to read and write pure RGB images (no headers, no standard image format crap, no compression), I want to be able to edit 1 pixel at a time without struggling to hit the desired spot. I want transparency support. Getting all that in a free package is tough, and I and stubborn, there isnt any reason to pay a massive premium for such simple things.

Beyond that and the above you quickly get away from 'needs' and off into specific things one needs for specific line of work. For example wireshark is just about required if you are doing networking, but I am not doing that these days.
For which OS are you developing?

If for MS, then familiarity with the build tools. See https://docs.microsoft.com/en-us/cpp/build/reference/c-cpp-build-tools?view=msvc-170

Last edited on
To be perfectly honest the use of an IDE is actually not even remotely necessary. Learning to do command-line compiling, especially by make files, is never a bad idea.

Advice I need to follow. Even if one uses Visual Studio the compiler can be used for command-line compiling.
Process monitoring tools. Process Explorer, Process Hacker, Process Monitor, etc. These offer different features that are useful for debugging non-intrusively (compared to a debugger), such as memory-dumping a live process, tracing system calls, etc.

VM software. VirtualBox, vmware, Hyper-V, Xen, QEMU, etc. are all good. The main thing you need is the ability to take snapshots. Cloning VMs is also very desirable.
This is useful to test that your build can run on a clean machine that doesn't have your development environment. If you're doing driver development, a VM is basically essential for debugging.

Having a REPL environment where you can check arithmetic quickly is incredibly useful, as long as the REPL language has similar semantics as the one you're working on. I often use Python or the C# Interactive window in Visual Studio.
Last edited on
like many things, though, maybe the advice here is to know yourself.
Pay attention to your activities as you code something -- where do you spend a lot of time doing dumb stuff? There is very likely a tool that will make that smoother. A simple example... if you are all the time wiggling code to make it align and look nice, just get a one click code pretty tool instead and stop wasting time. The intro to a book I had long ago put it something like this... "long ago the tools became good enough to get the job done. The problem is you and your skill set and ability to use what you have been given". Learning to use this stuff takes almost as much time and energy as learning to code ... esp stuff like building c++ from make, or running a debugger effectively.
...absolutely. For VS, look at the available online extensions. Many good ones are free.

I agree re the tools. Learning to use available tools (even the debugger) IMO is something that isn't really covered in programming courses/books - but are things that every serious programmer needs to get to grips with and become familiar. One of my old lecturers once said that 'time spent not designing and not writing code is effectively wasted time'.

Thank you very much guys.
Since I'm using C++ on VS, I try to explore what visual studio offers on their website especially build tools and extensions. Of course, I use its debugger whenever needed.
I'm also using GammaRay on Qt.

Apart from the above-mentioned great tools I hear at times somethings called
1) "automatic unit test/testing"
2) GUnit (what I found on google about that was an American hip hop group!)
3) Jira.

I completely agree with what jonnin said in his last post here that I should not waste my time using every tool but only when I need one.

Which one of the three tools mentioned above is good to you too? I like to pick one of them and use it with other tools (VS build and extensions (for C++) and GammaRay (for Qt)).
I don't know why people think an IDE is absolutely necessary.
There's no such thing as something absolutely necessary. Things are only necessary relative to desired goals. It's not necessary for me to continue eating, if I'm okay with starving to death. Likewise, it's not necessary to use an IDE, if you're okay with not having any of the features only IDEs provide.
For example, I can build by project with a single keystroke. I can do without that feature, but if I want to keep it, I need the IDE.

I've been coding for like 10 years now and never required one.
Okay, but have you tried using one daily for one or two months? Which one?

I'll suggest you to go for command-line compiling by making files. It'll be a lot better for you in the long run.
Why?
The program I work on at my job takes 30+ min to compile from scratch on an up to date pc (20 cores, 64 gb ram, ssd, etc). It consists of over 30 sub-projects and uses another 10+ large libraries. This is all organized in a folder tree like structure that is easy to understand in my IDE. Writing make files for all that by hand and keeping them up to date as files are added and removed (daily) would be a full time job for 2 people, not to mention the release candidate vs the in progress code versions and such. The IDE also gives me clean debugging, and WYSIWYG UI editing. I can double click an error or warning and it opens the correct file and puts the cursor on the correct line. If I see something I do not know what is, I can mouse over it and it tells me the type and if I want more I can right click and go to that class definition. It gives me a list of who inherits what, the whole chain. I could go on but these are a small number of the things provided by the IDE that I use almost daily. It saves probably a couple of hours a day vs doing it by hand. And, the kicker: apart from the make file, I can do anything else command line any time I want to. I routinely use grep, not because the IDE lacks a good search but because its a little more flexible and faster and can pipe-chain to search within results of another search.

All that to say, I do small programs on the command line, mostly the examples here but any 1-2 page hack program I crank out is done that way because its easier and faster than setting up a project for one file. The right tool for the job is the idea here. Whatever tools are most efficient for getting it done are what you should use. In these cases I mention, our large program is just not well suited for efficient development on the command line, and in that sense, yes, the IDE is completely necessary.
vic11con wrote:
I don't know why people think an IDE is absolutely necessary.

Not necessary I use Visual Studio, though using it makes coding damned easy and convenient so I can concentrate on the code instead of various steps of testing to get an app that runs.

I get an integrated editor, compiler, and app launcher that does debugging when I need it.

Intellisense pops up errors and many warnings in my code even before I push "compile."

I have various in-VS settings tweaked so I get nicely formatted code, and with extensions I can enhance what is possible with VS.

Currently one of the best reasons why I use an IDE, with that IDE being Visual Studio, is C++20 compliance. No other compiler fully supports the C++20 standard.
https://en.cppreference.com/w/cpp/compiler_support/20

No modules (not a big deal, but they are part of the standard so I use them), no std::format. Two parts of C++20 I use routinely and really want to use in my code.

I can do command-line compiling with the VS compiler, if I so choose.
https://docs.microsoft.com/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line?view=msvc-170
https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170

I am not a professional coder, nor someone who has had any formal class-room instruction. I am a self-taught hobbyist. I've been learning the ins-and-outs of C++ since it was ANSI C++, before C++98.

IDEs give me a helping hand that relieve me of a lot of the detail work needed when I code, be it Visual Studio or Code::Blocks or Dev-C++, etc.

If someone finds it easier to not use an IDE, great. Whatever makes a particular person productive is a good thing.
1) "automatic unit test/testing"

That's 4 words that encompass different things:

a) Unit testing

This is writing small tests, that are quick to run, that test indivdual parts of your code in isolation, to determine that each part does what it's supposed to. Typically, a unit test will test a single function, or possibly some aspect of a single class's functionality.

If you're writing a big project, it's an extremely useful tool. Writing the tests helps you think clearly about the design and functionality of your code, because helps you focus on what exactly it is that the code under test is supposed to do, and what the error conditions are. I'd definitely advise looking into it, and learning how to do it.

Several people have written unit test frameworks, to help make it quick and easy to write unit tests. My personal favourite is Catch2, but some others I've used are GoogleTest and CppUnit, which are fine too.

b) Automatic testing

One can automate any kinds of tests, not just unit tests. There are many different frameworks available for this, and the type of testing you want to automate will determine which kind of solution is right for you. There's not much point going into more detail, without you being more specific.

2) GUnit (what I found on google about that was an American hip hop group!)

What I found with an extremely simple and easy Google search, was that it's another unit testing framework, based on GoogleTest (and GoogleMock) which claims to sumultaneously "extend and simplify" those things.

3) Jira.

JIRA is a tool for tracking the way you work. It allows you to record "tickets" for the tasks you want to do, and organise work in various different ways. Very helpful if you're working in a team, or you need to keep track of a large project where you're working to deadlines, but otherwise, not really essential.
@MikeyBoy

I'm interested in installing and using Catch2 for my C++ programs unit testing. Could you please tell me the easiest way to install and use it, please?

My IDE: Visual Studio 2022 (Version 17.1.1)
OS: Windows 10 x64

Thanks in advance.
Catch2 is one of the 1,859 packages vcpkg has available.

What is vcpkg?
https://vcpkg.io/en/index.html

It can be integrated into VS 2015 or newer.
I downloaded the Zip file of the package from its Github address and extracted it on my Desktop in a folder: vcpkg-master. Then ran a CMD and typed the following command as stated here: https://vcpkg.io/en/getting-started.html, but got an error! :(

C:\Users\ME>cd desktop
C:\Users\ME\Desktop>cd vcpkg-master
C:\Users\ME\Desktop\vcpkg-master>.\vcpkg\bootstrap-vcpkg.bat
The system cannot find the path specified.

C:\Users\ME\Desktop\vcpkg-master>
Last edited on
extracted it on my Desktop in a folder

Did you try a folder like what the getting started page suggested?

I installed vcpkg using git to D:\Programming\vcpkg and had zero issues getting it to integrate into VS.

If your command prompt is already at the location vcpkg is installed just run bootstrap-vcpkg.bat
OK. I created a folder called dev on C:\ and inside it another called vcpkg. Then using CMD (run as administrator) went into that path and cloned: git clone https://github.com/Microsoft/vcpkg.git

Then ran this: .\vcpkg\bootstrap-vcpkg.bat and finally vcpkg integrate install.

I guess it's now installed.

Now how to install Catch2 on Visual Studio 2022 to be able to text code, please?

PS: In an existing code I tried including catch2 this way: #include <catch2\
but no IntelliSense came up.
Last edited on
Intellisense is a bit buggy. No ifs, ands or buts. Despite what MS says.

Did you try #include <catch.hpp> ?

[ETA]: Make sure you installed both the 32-bit and 64-bit versions. vcpkg apparently installs the 32-bit version by default without specifying what version.

I did and a new project automatically found <catch.hpp> as I typed since VS 2022 default to 64-bit.
Last edited on
Yes, and I get two errors:

Severity Code Description Project File Line Suppression State
Error (active) E1696 cannot open source file "catch.hpp"

Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'catch.hpp': No such file or directory
Pages: 123