Can I use a templated Type Alias for defining a Template Class' Methods in...
Sometimes I like my template class method definitions in a source file (or second header) to reduce build times. In all my source files I use a type alias for the class I'm defining the methods of to...
View Articlegcc-arm-none-eabi 11.3 "is not implemented and will always fail"
I'm working on a bare-metal STM32 project, compiling on a Linux x64 host.After upgrading my toolchain from gcc-arm-none-eabi-11.2-2022.02 to arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi, I get the...
View ArticleWhy do I have to compile with `-static`? [duplicate]
I have the following assembly code global main extern println section .textmain: mov rdi, message call println retmessage: db "Hello, world!", 0I am linking it with some C code#include...
View Articleg++ - size of a binary semaphore
I am using a binary semaphore in a struct like so:struct Header {uint64_t otherfields...binary_semaphore sem;[hidden padding of 4 bytes if sem is 4 bytes]uint64_t post_otherfields..};int main() {cout...
View ArticleG++ Failing to link ncurses even though it has the -lncurses flag [duplicate]
I'm trying to compile an ncurses file using g++. It gives this output which would suggest that it isn't linking correctly. Interestingly it compiles fine under clang++. I have ncurses installed from...
View ArticleYocto kirkstone oe linux x86_64 gcc not finding usr files
Building grafana 9.2.0 from bb recipe on yocto kirkstone 4.0 results in x86_64-oe-linux/gcc ld error missing various .a, .o, and .so files.These files are in fact located alongside this generated...
View Articlegcc why does -Woverflow not catch int8_t i = 128;?
int8_t has a range of -128 to 127, so when compiling the code#include <stdint.h>int main(){ int8_t i = 128; (void)i;}withgcc t.c -Woverflowwhy does it not catch the 128 overflow? fwiw gcc catches...
View ArticleHow do constants for signed division differ from unsigned division when using...
While using Godbolt Compiler, I was playing around with various functions when I checked what signed division looks like using the following code:int div10(int num) { return num / 10;}Where the num/10...
View ArticleHow can I add command-line options file to CMake compiler flags?
GCC allows for having command-line options passed by a file by @file syntax. Using this the file should be added as prerequisite (aka dependency) to the target.I'm not finding any reference in CMake...
View ArticleHow to enable ccache on Linux
There is very little documentation on enabling ccache on GNU/Linux. Here is a response from launchpad.net:At the moment, I think the best way to enable ccache is to add"/usr/lib/ccache" to the front of...
View ArticleWhy do I get either a double free or corruption (out) or a C malloc assertion...
I am writing a code for a physics simulation, evolving some copies of the initial state with a stochastic and a deterministic evolution, returning the the value of some observable at each timestep of...
View ArticleHow to know the stack size limit of .exe program?
It seems my program (built with mingw g++) crashes due to insufficient stack memory. I use the compiling option -Wl,--stack,64000000 to increase the stack limit but the problem persists. I want to know...
View ArticleWhere are C header files in gcc 7?
On a linux server which has an old version of gcc (4.4.7), I built gcc 7.4.0 from source code and installed it in a directory within the home.Now I'm not sure how to use it. The directory includes some...
View ArticleWarning: No available formula with the name "gcc". on mac(intel)
I want to use gcc compiler instead apple clang on my mac(intel).But this error is shown.. " Warning: No available formula with the name "gcc" "I did, 1. installed homebrew2. brew install gccBut this...
View ArticleError installing python-snappy: snappy-c.h: No such file or directory
I am using amazon ec2 ubuntu 11.04 server sudo pip install python-snappy also I tried to downloaded package and entered "sudo python setup.py install"I got the error: running build running build_ext...
View ArticleNo compiler warning for 'const' pointers of non POD types when overriding a...
An example where one is overriding POD return type without const in the derived class:struct B1{ virtual const int* f();};struct D1 : B1{ int* f() override;};Compilers like Clang and GCC raise a...
View ArticleLink libsndfile source code with gcc
I just cloned libsndfile and created program.c file with the following contents:#include <stdio.h>#include <sndfile.h>main() { printf("hello world");}My goal is to get this file to compile...
View ArticleGCC Linker Script Ignore PHDR / PHDRS?
I'm trying to target a flat file for the output of my code, where I don't want PHDR. But it seems no matter how I set things up, in modern GCC versions, I can't avoid PHDR.Either I get PHDR segment not...
View ArticleGcc - c++ - force trailing return to functions
After reading gcc warning page I would like to force every function to have their return type definedauto f() -> force_this_return_type_presence{}I would have liked a gcc warning turned into an...
View ArticleBOOST programm options error when importing in python
I have a boost module called arachne, when importing this module in a python script called submitArachne I get the follwoing error: Kolophon/shlib/arachne/arachne.so: undefined symbol:...
View Article