How to crosscompile all sources from a directory using gcc-linaro (Windows 10)
I'm running into a problem trying to write a Makefile for cross compilation for a Beaglebone. I'm using gcc-linaro 7.5.0 on a Windows 10 machine.The problem occurs when I try to put all sources from...
View Articleextra padding between structs in C
I have struct in C:typedef struct Node { int data; // 4 bytes int + 4 bytes for alignment struct Node* prev; // 8 bytes pointer struct Node* next; // 8 bytes pointer } Node; The size of this struct is...
View ArticleError in GCC when trying to install AUTO-07P on mac
I am new to mac, and I am trying to install the software AUTO-07P on my macOS (version 10.14.6). I have found the following instructions - link. The instructions are not updated, so I am not sure...
View ArticleLinker error with empty braces initialization
The following code compiles normally:#include <iostream> #include <map> #include <string> struct Config { std::map<std::string, std::string> info; }; void f(const Config& =...
View ArticleUsing gcov to test a c++ program
I am using gcov for the first time to analyze my program (C++) The program consists of three classes and I have built the project using Code::Blocks. When I am invoking the program using the following...
View ArticleWhy does gcc converts floating point literals to double even after using an f...
This question already has an answer here:Default argument promotions in C function calls 3 answersConsider the following code from C Primer Plus:#include <stdio.h> int main() { float f = 7.0f;...
View ArticleHow can I ignore all warnings from included headers in clang/gcc?
I want to use #pragma clang diagnostic push to ignore warnings from some included header files. So I write this:#pragma clang diagnostic push #pragma clang diagnostic ignored "-Wall" #include...
View ArticleHow to set the size of enums to 32 bits with arm-gcc without using...
I need to fix the size of enums in arm-gcc to 32 bits. I don't want to use -fno-short-enums because it generates a warning because of other libraries I'm linking against.I have tried...
View ArticleWhen compiling with gcc, overloaded new operator is not called for std::string
This program (compiled with option -std=c++17)#include <stdio.h> #include <string> void* operator new(std::size_t nrOfBytes) { printf("allocate %zd bytes on heap\n", nrOfBytes); void* p =...
View ArticleShort int in printf stores a value out of range
Why is it possible to store -32 768 as a short int?printf("%hd", -32768); //returns -32768, no compiler errors printf("%hd", (short int)-32768); //returns -32768, no compiler errors short int a =...
View ArticleA pointer to array of forward declared structures in C
I have a question about forward declarations in C. The problem code is typedef struct yhash_s t_yhash; // forward declaration struct yhash_s { size_t size_h; t_yhash (*yhash)[]; // pointer to array of...
View ArticleGCC unable to compile Go Program
I wrote a very simple program in Go using using a 2D game library.package main import ( "github.com/hajimehoshi/ebiten""github.com/hajimehoshi/ebiten/ebitenutil" ) const screenWidth, screenHeight =...
View ArticleHow to fix 'sincos@@GLIBC_2.2.5' undefined reference for fftw3 library
I have been trying to install and execute a c-program using fftw3 library on Ubuntu machine but getting this error so many times.How to fix the error? Help is much appreciated.latest source code was...
View Articlegcc add unwanted parameter to function [closed]
I wrote this function, lvalue is 64bit integer:__attribute__ ((noinline)) lvalue call_method(method_t *method, lvalue *args) { lvalue (*func)(lvalue *) = method->func; return func(args); } where...
View Articlevariadic macro that handles last argument in a different way
I was wandering if there is a way to define a variadic macro that handles its last argument in a different way.For example, can I define a macro that prints a custom separator after every argument...
View ArticleDefining #if preprocessor condition in C
I wanted to define a compile time input validity checker for the library I am developing. So I thought maybe #define a function like #if preprocessor in C which is going to be compiled with GCC,...
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 ArticleFree up memory immediately by swap trick (C++) [closed]
I have a very large vector as follows.vector<vector<int>> a(100000, vector<int>(100000); // do some work using a here ...... After the work is done, I...
View ArticleC++ Floating point difference
I am trying to get exact same results on 2 different platform i.e. Solaris and Linux(sun-studio vs GCC). The entire code uses double datatype. But when i print the output i see differences in the...
View ArticleWhen compiling with MINGW gcc, overloaded new operator is not called for...
This program (compiled with option -std=c++17)#include <stdio.h> #include <string> void* operator new(std::size_t nrOfBytes) { printf("allocate %zd bytes on heap\n", nrOfBytes); void* p =...
View Article