How many GCC optimization levels are there?
How many GCC optimization levels are there?I tried gcc -O1, gcc -O2, gcc -O3, and gcc -O4If I use a really large number, it won't work.However, I have triedgcc -O100and it compiled.How many...
View ArticleHow to declare a variable as thread local portably?
C11 introduces the _Thread_local storage class specifier that can be used in combination with the static and extern storage class specifiers to declare a variable as thread local. The GNU C compiler...
View ArticleBuilding cross compiler: pthread.h: No such file or directory
I'm currently trying to compile my own gcc 9.1.0 cross compiler for aarch64-linux-gnu target. I used this tutorial: https://wiki.osdev.org/GCC_Cross-CompilerThe compile progress for the gcc and g++...
View ArticleHow to distinguish preprocessor and compiler directives?
I have been told that #pragma omp directive in GCC is directive of the compiler, and is not directive of the preprocessor.Is it correct?How to distinguish preprocessor's and compiler's directives?
View ArticleHow to Run and Compile .c on Sublime Text 2 [MAC OS X]
I am learning C at college now, and teachers told me to use codeblocks as an IDE, but in my opinion codeblocks is a bit ugly and that's why I've chosen Sublime Text 2, the BEST IDE/Text Editor out...
View ArticleWhy does MSVC not use __popcnt in its implementation for std::bitset::count?
I was curious to see whether or not MSVC used the compiler intrinsic __popcnt for bitset::count.Looking around, I found this to be the implementation for std::bitset::count for VS2017:size_t count()...
View Articlecollect2.exe: error: ld returned 116 exit status
windows 10, gcc is installed via msys2, path: "C:\msys64\ucrt64\bin".When compiling with g++, i get an error "collect2.exe : error: ld returned 116 exit status.",example: g++./project.cpp -...
View ArticleHow to use the -MG flag in cc 4.4.1?
I've recently upgraded my Ubuntu installation from Jaunty to Karmic. This apparently includes an update of the GNU C compiler, because code that compiled previously no longer does.Running cc 4.4.1...
View ArticleMWE among object file compiled with and without `-fPIC`
I was doing some experiment with object file produced by gcc.While I know, at least superficially, what is the use of position independent code, I was trying to spot it concretely.I produced this...
View ArticleHow to change compiler on Clion from clang to gcc on MacOS?
The only compiler that works on my CLion is the clang one which is detected by default in toolchains. I need to use gcc (my college class grades using the gcc compiler so I want to avoid any unexpected...
View Articlefatal error: Python.h: No such file or directory
I am trying to build a shared library using a C extension file but first I have to generate the output file using the command below:gcc -Wall utilsmodule.c -o UtilcAfter executing the command, I get...
View ArticleIs it ok to use std::ignore in order to discard a return value of a function...
I know that you can use static_cast<void>, but it just seems too verbose for me, and not reflecting the original intent that I want to discard a return value, not to cast it to anything.Recently...
View ArticleCMake save stripped debug information
It's a usual practice to compile with debug symbols and then separate the binary using objcopy into the release executable and the file with debug information (then wrap that into separate packages or...
View ArticleUsing GSL on Windows (compiling, linking, ect). A Step by Step Guide
I need to write some C code using GSL (GNU Scientific Library), and have never used libraries before.I am a Physicist, not a computer scientist, and struggle with a lot of the jargon in the GNU...
View ArticleIs GCC right with -Wuninitialized?
Let's consider the following code (Compiler Explorer):#include <array>#include <cstddef>#include <new>struct Data{ //Data() {} // TODO int value;};auto test(){ alignas(Data)...
View ArticleParameter packs not expanded with '...' c++17 - gcc bug?
Consider the following simple code:template<typename ...types>class myclass{ using payload_type = mylib::type_traits::type_or_tuple_t<types...>; template<typename... T>...
View Articlexv6 "Booting from Hard Disk" infinitely on QEMU
I have to run the xv6 OS on the QEMU emulator, using GDB to debug. I am using WSL on Windows to run a Linux environment. But everytime I try to run the program in QEMU, it just says "Booting from hard...
View Articlecommand 'gcc' failed with exit status 1
I tried all answers but I can't solve the problem of installing Biopython packageI installed Mingw , but when I try to install the package : python setup.py installI get the following error: running...
View ArticleWhat does C or GCC do when implicit function declaration exists
#include <stdio.h>int main(void){ float a, b; a = 0.0f, b = 1.0f; printf("%d\n", plus(a, b)); return 0;}int plus(double a, double b){ printf("%lf %lf\n", a, b); return a + b;}gcc .\p1.c --std=c89...
View ArticleCannot install fastText because gcc 7.3.1 does not support C++11 on Amazon Linux
I need to install a system that uses fastText onto an Amazon Linux machine.As practice, I have been trying to build fastText from source inside an Amazon Linux 2 docker image. I noticed gcc wasn't...
View Article