Debug vs Release in CMake

With CMake, it’s generally recommended to do an “out of source” build. Create your CMakeLists.txt in the root of your project. Then from the root of your project: mkdir Release cd Release cmake -DCMAKE_BUILD_TYPE=Release .. make And for Debug (again from the root of your project): mkdir Debug cd Debug cmake -DCMAKE_BUILD_TYPE=Debug .. make Release … Read more

Convert char to int in C and C++

Depends on what you want to do: to read the value as an ascii code, you can write char a=”a”; int ia = (int)a; /* note that the int cast is not necessary — int ia = a would suffice */ to convert the character ‘0’ -> 0, ‘1’ -> 1, etc, you can write … Read more

Why is my program slow when looping over exactly 8192 elements?

The difference is caused by the same super-alignment issue from the following related questions: Why is transposing a matrix of 512×512 much slower than transposing a matrix of 513×513? Matrix multiplication: Small difference in matrix size, large difference in timings But that’s only because there’s one other problem with the code. Starting from the original … Read more

What is the difference between g++ and gcc?

gcc and g++ are compiler-drivers of the GNU Compiler Collection (which was once upon a time just the GNU C Compiler). Even though they automatically determine which backends (cc1 cc1plus …) to call depending on the file-type, unless overridden with -x language, they have some differences. The probably most important difference in their defaults is … Read more

Compiling an application for use in highly radioactive environments

Working for about 4-5 years with software/firmware development and environment testing of miniaturized satellites*, I would like to share my experience here. *(miniaturized satellites are a lot more prone to single event upsets than bigger satellites due to its relatively small, limited sizes for its electronic components) To be very concise and direct: there is … Read more

fatal error: Python.h: No such file or directory

Looks like you haven’t properly installed the header files and static libraries for python dev. Use your package manager to install them system-wide. For apt (Ubuntu, Debian…): sudo apt-get install python-dev # for python2.x installs sudo apt-get install python3-dev # for python3.x installs For yum (CentOS, RHEL…): sudo yum install python-devel # for python2.x installs … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)