Selected processor does not support `dmb ish' in ARM mode
I am building an embedded linux distro on a Beaglebone Black (AM335x chip Cortex-A8 Arm-v7 Instruction set) using crosstool-NG, U-Boot, Kernel (5.5.5) and buildroot. When compiling the kernel I am...
View Articleambiguous template instantiation error with gcc
For the code below I get an ambiguous template instantiation error with gcc.However, using Clang or Visual Studio the Code compiles fine. A full working example of the code can be found...
View ArticleHow to sort std::set of indices according to the vector of sorted indices?
I have a class MyClass, which operates with some double values beta, stored as a class member, in it's member function g. It sorts them and stores the permutation in the class member...
View ArticleWhat should I fix when Address Sanitizer says detect_leaks is not supported...
I'm using Clang to compile my project, on x86_64 OS X(MacOS 10.15.5 Catalina).I want to identify exactly from which file, which function, which line causes memory leaks. I am trying to use Address...
View ArticleC++17, string + string_view gives compilation error [duplicate]
As per the C++17 book from "Nicolai M. Josuttis" the following code should compile.#include <string_view>#include <string>int main(){ std::string_view sv1 = "hello"; std::string_view sv2 =...
View Articlepybind11 & dlib: CMake alternative for gcc command
I'm trying to build a *.whl python package from C++ source using pybind11 and dlib.This GCC works great for me:gcc -O3 -Wall -shared -I /home/user/dlib /home/user/dlib/dlib/all/source.cpp -lpthread...
View ArticleIs `extern` required to make an inline function definition externally linked?
GCC can compile and link the following .c files into an executable:main.c#include <stdio.h>#include "addsub.h"int main(void){ printf("%d %d\n", add(1, 2), sub(1, 2)); return 0;}addsub.c#include...
View ArticleHow to compile with headers and a create a Makefile - C
I am trying to compile and create a Makefile with my source code organized as per the following structure:|-- build|-- include| \-- functions.h\-- src|-- functions.c\-- main.cThe code written there has...
View ArticleSegmentation fault while using cout
I have a very strange issue. I'm seeing a segmentation fault while using COUT to print an int. below is the code.#include <iostream>int main(){ std::cout << "Hello"<<std::endl;...
View Articletell CMake to link to Boost in a custom folder
I'm trying to install boost in a custom dir. I did:cd boost_dir./bootstrap.sh --prefix=/custom_dir./b2Now what I want to do is tell CMake to point to that library. To that end, I added:set(BOOST_ROOT...
View ArticleWhy is a returned stack-pointer replaced by a null-pointer by gcc?
I've created the following function in c as a demonstration/small riddle about how the stack works in c:#include "stdio.h"int* func(int i){ int j = 3; j += i; return &j;}int main(){ int *tmp =...
View ArticleHow can I link __sync_bool_compare_and_swap_16?
I've got some code that uses the gcc builtin __sync_bool_compare_and_swap, which is mapped to __sync_bool_compare_and_swap_16 at linktime. But when I link this code I get a "undefined reference to...
View ArticleIs there a `clang++:-Wunused-lambda-capture` equivalent warning in/being...
BackgroundI sometimes run into code that use the following dummy lambda-capture (instead of e.g. (void)x;, ... foo(int /* x */) or ... foo([[maybe_unused]] int x) in C++17) in order to remedy an unused...
View ArticleWhy [[likely]] attribute in C++20 raises a warning here?
#include <iostream>int foo(int a, int b){ if(a < b) [[likely]] { return a; } return b;}int main(){ std::cout << foo(3,1) << std::endl;}DemoAccording to the reference, it seems like...
View Articlecan't compile basic program using gcc ubuntu ld: unrecognized option -p
I was installing a library called libelf from sourceforge https://sourceforge.net/projects/elftoolchain/files/Sources/ I installed all the packages listed under the INSTALL file, it seems like the...
View Articlegetting ld to ignore undefined references when making a shared lib
I'm trying to get gcc's ld to ignore unresolved references when putting together a shared library from a bunch of object files compiled with -fpic flag.I tried a bunch of options so far such as...
View ArticleHow to configure GCC such that `long double` = `double` = 64 bits
I'm cross-compiling GCC (6.4.0) on a X64_64 machine for i386, and trying to specify that long double should use 64 bits like double. The GCC documentation has configuration flags like...
View ArticleWhat does unrecognized option -p in gcc means? [duplicate]
I'm trying to run a basic hello world program but compiling withgcc -o hello hello.c I get the following errorld: unrecognized option -p collect2: error: ld returned 1 exit statusI'm not really sure...
View ArticleWhen the program built with C::B doesn't work
I made a small c++ project and it was fully compiled and built it.#include <iostream>using namespace std;int main(){ cout << "Hello world!"<< endl; return 0;}When I run through c::b...
View ArticleA couple of complicated exponential operations in C return inf? [duplicate]
#include <stdio.h>#include <math.h>int main(){ printf("Hello World! \n"); double a = 56; double b = pow(a,a); double c = pow(b,b); double d = pow(c,c); double e = pow(d,d); printf("%lf\n",...
View Article