How can I prevent static data type conversion in C++ with gcc?
I am not sure if my question explains my problem correctly, but I made following observations:I have following C++ program, that I compile on Ubuntu 64bit with default options:g++ test.ctest1.c:int...
View ArticleWhy doesn't gcc devirtualize through a pair of related CRTP hierarchies?
I have a pair of types sharing a loose client/server relationship. The types are nontrivial, so to make them unit testable, I've split them along aspects using decorator. Each decorator adds one aspect...
View ArticleHow to disable narrowing conversion warnings?
I use -Wall and updating to new gcc I have got a lot of warning: narrowing conversion. I want to disable them, but leave all other warnings untouched (ideally).I can find nothing about narrowing in...
View ArticleCross compile PHP for aarch64 - error can not run test
I'm trying to compile PHP 7.0.1 (downloaded on PHP website) for aarch64 platform.(aarch64 GNU/Linux)I configure for compile like this : export ARCH=arm64export CROSS_COMPILE=aarch64-linux-gnu-export...
View ArticleEclipse CDT: Where should I define a macro
Where should I define preprocessors macros so that eclipse calls gcc with the -D marco=def argumentsI tried with Project Properties > C/C++ General > Preprocessor Include, Path, Macros etc... but...
View ArticleSelect the compiler of g++ between clang and gcc
I have installed gcc with brew and I have a Mac with Mojave. There is a way to compile with gcc or clang ? Because I use clang (is the default compiler) but sometimes I want to use gcc just saying gcc...
View ArticleHow to upgrade GCC on macOS Catalina
On macOS Catalina I have an old, pre-installed version of GCC (4.2.1) that is not compatible with other libraries that I need to use... How can I upgrade to a more recent version (I need 4.4 at...
View ArticleHow can a shared library (.so) call a function that is implemented in its...
I have a shared library that I implemented and want the .so to call a function that's implemented in the main program which loads the library.Let's say I have main.c (executable) which contains:void...
View Article(arm-none-eabi-gcc) creating .elf binary from bootloader + 2 x firmware image
I'm developing for a STM32F429 with CLion and trying to create a merged .elf file from three .elf files.The layout of the merged .elf file should look like this:Bootloader.elf (maximum 256K, but can...
View ArticleStatic assertion to check if a variable name is defined in the current scope
I am defining a macro like the following and my goal is to complete the TODO.#define TEST(_expr, args...) \ do { \ // TODO _Static_assert to make sure __xyz is not declared \ int __xyz = _expr; \ if...
View ArticleOpenMP C Program Clarification
If you want to access the thread-local values of a privatized variable from outside of the parallel scope, you can write them back to a globally declared auxiliary array. This is the way it was...
View ArticleProvoke long calls of __aeabi_fxxx functions with GCC on arm cortex
I am trying to provoke long calls of __aeabi_fmul function from a foo.c file.I am not using libgcc, during linking i am passing a symbol file that has the address of __aeabi_fmul.In foo.c i can see...
View Articleundefined reference to `__stack_chk_fail'
Getting this error while compiling C++ code:undefined reference to `__stack_chk_fail'Options already tried:added -fno-stack-protector while compiling - did not work, error persistsadded a dummy...
View ArticleWhy is there ambiguity between uint32_t and uint64_t when using size_t on Mac...
Consider following example code:#include <iostream>#include <inttypes.h>using namespace std;int f(uint32_t i){ return 1;}int f(uint64_t i){ return 2;}int main (){ cout << sizeof(long...
View ArticleNot same behavior of Make in Windows as on Linux, how to compile simple C++11...
I have started to study C++ and previously compiled with make in Linux. Now I'm trying to use VS Code in Windows with the Codeblocks GCC package installed and added the appropriate path to the PATH...
View ArticleCompare values using "asm" C++?
I have some problem when I'm using 'asm' in C++.I need to find max value in array, I wrote the code but it doesn't compare.void func1(int x[],int lenght){ // Find MAX int max, z = x[0]; //Make first...
View ArticleGetting error when using python parser with rust-bindings in tree-sitter
I want to use tree-sitter-python parser in my rust code with tree-sitter rust bindingI have successfully used javascript parser but getting error when I am using python parser.My observation:Javascript...
View ArticleCannot run gcc with the -fopenmp flag on macOS
I have gcc 9.3 running on macOS, and I'm running a gcc command with -fopenmp flag, but I get the error: Unsupported optionerror: unsupported option '-fopenmp'```. How do I fix this?
View ArticleC/C++ reverse definition [closed]
I have file test.txt which contains:hwidjhcxgugdish0ikjhgy1khjkghvcgj3ihgyuhk1guijh2igkhbj2jkuigk1And I have C header file test.h:#define VAL1 0#define VAL2 1#define VAL3 2#define VAL4 3#define VAL5 0I...
View ArticleUse -isystem instead of -I with CMake
Is there any way in CMake to force a path specified via include_directories (or perhaps through a different function) to use the -isystem flag instead of the -I flag when building with gcc?See...
View Article