Fix undefined references to integral static constexpr when referenced in...
I have a project which is compiled at the O2 optimization level with GCC, but I occasionally put __attribute__((optimize("O0"))) before a function definition so that it's easier to step through during...
View ArticleCLion Linker Error with Standard Library and GCC
I am taking a class which requires the use of GCC as the compiler. I am trying to ensure CLion is using GCC, but I no matter what I do I keep getting the following error upon trying to run my file:...
View ArticleWhich Linux library contains `cmdinfo` `cmdparse` cmdparsescript` and `cmdusage`
I am trying to build a project for Raspbian with libpigpio but Im getting undefined reference errors to the following functions:Error undefined reference to `cmdInfo' Error undefined reference to...
View ArticleHow to build libgpio.a from a makefile that builds libgpio.so
I need to build this static library using the makefile, but there is no existing option to build a libgpio.a fileI was able to build it, but for some reason I am getting undefined reference errors when...
View ArticleWhy is _mm512_store_pd super slow in this matrix multiplication code?
I'm playing with avx512 and matrix multiplications but I must be doing something wrong because I have awful performances when I try to store my results using _mm512_store_pd. Here are the relevant...
View ArticleWhy can't GCC assume that std::vector::size won't change in this loop?
I claimed to a coworker that if (i < input.size() - 1) print(0); would get optimized in this loop so that input.size() is not read in every iteration, but it turns out that this is not the case!void...
View ArticleWhat standard says about anonymous namespace and internal linkage?
I'm curious about this fact as I came up with the following code:namespace { int my_variable = 12; void get_data_a_lot() {} } int main() { my_variable++; get_data_a_lot(); } and compiling with msvc I...
View ArticleShould a definition inside template class be instantiated if it is not used?
template <typename T> struct A { static constexpr T obj {}; static constexpr bool noexcept_copy = noexcept( T{obj} ); static void UsesCopy() { T{obj}; } static constexpr int C = 1; }; struct...
View Articlecommand 'x86_64-linux-gnu-gcc' failed with exit status 1
I tried to install "scholarly" package, but I keep receiving this error: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time...
View Articlegcc weak attribute inconsistent behaviour
I am using gcc compiler in windows10's powershell. gcc came with the Atollic TrueSTUDIO ide. The reason I am doing this is to be able to create an .exe file from the C code so unit testing becomes...
View ArticleLDR pseudoinstruction
when I create ARM assembly code from C code with gcc -S, I get a variant of the LDR instruction that I don't know. Specifically, I get the "ldr r3, .L5" instruction where ".L5" is a lable defined by...
View ArticleUpgrading from crosstool to crosstool-ng binutils 2.15, gcc 3.3.6 and glibc...
I am trying to upgrade our ancient embedded system and the first step is using Crosstool-ng instead of crosstool. Our host machine's kernel version is 2.6.22 and gcc version on host is 4.2.1. We are...
View Articlevariadic template of a specific type
I want a variadic template that simply accepts unsigned integers. However, I couldn't get the following to work.struct Array { template <typename... Sizes> // this works // template...
View Articleapt in Linux Subsystem for Windows 10 is failing with 404 Not Found
OK, so this is my first SO question so I'm gonna try my best to lay this out.I have a Windows 10 laptop on which I am trying to install gcc. I have in the past tried alternatives such as netbeans,...
View ArticleC FFF mock redefinition
I'm trying to use the FFF mocking library for C (https://github.com/meekrosoft/fff) to unit test C code. The issue I'm running into is gcc is seeing my mock object as a redefinition of the original...
View ArticleWhat causes this compiler discrepancy whilst using function-like macros...
The A() macro will only expand on MSVC, but not GCC/Clang unless A() is placed with a prefix e.g. Test A().By running the following snippet under the -E (/E) flag (godbolt.org):#define A() HelloWorld::...
View ArticleCould some tell me why I'm getting this error - Template LinkedList [duplicate]
I've been trying to implement a doubly-linked list with templates in c++. I've had some problems saying that the member function for the specific type that I was calling wasn't referenced, so I've...
View ArticleRemove the comments generated by cpp
I use #include ".../frontend/tokens.mll" in lexer.mll, and then cpp -C -P frontend/lexer.mll -o frontend/lexer_new.mll to generate lexer_new.mll.That worked until I upgraded my ubuntu from 12.04 to...
View ArticleHow to change clang to gcc in MacOs?
Is it possible to prevent MacOS to stop mapping gcc to clang?i want to run a tool its dependency is with gcc and not for clang. So i installed gcc but since i typing in gcc -v i am getting the mapped...
View ArticleInstalling GCC on macOS Catalina
I am on macOS Catalina and trying to install GCC by following the instructions here: https://solarianprogrammer.com/2019/10/12/compiling-gcc-macos/Everything seems to work fine until I try to...
View Article