Approved way to avoid lvalue cast warnings and errors?
This is related to JoGusto's answer at Casting Error: lvalue required as left operand of assignment. In the answer, he/she states:but there is one case where it is not true: casting, then dereferencing...
View ArticleHow to cross-compile D-Bus to ARM?
I want to cross-compile D-bus to arm.Toolchain: arm-linux-gcc-3.4.1configure option: CC=arm-linux-gcc ./configure --prefix=/opt/dbus/ --host=arm-linux --enable-abstract-sockets -with-xml=expatSource...
View ArticleMakefile for AVR
I have folder "I2C AtMega32":and I have my simply Makefile:all: main.hex program cleanmain.o: main.cpp BMP280_driver-master\bmp280.c avr-gcc -Wall -Os -mmcu=atmega32 -c $< -o $@main.elf: main.o...
View Articleconfigure: error: cannot run C compiled programs. (Installing GAP on Arch Linux)
I am trying to install GAP on Arch Linux (on my Steam Deck). Please don't ask why, I am not able to answer this question. When trying to run the configure script, I can get some strange C error. When...
View Articlewhat's the difference between __builtin_popcountll and_mm_popcnt_u64?
I was trying to how many 1 in 512MB memory and I found two possible methods, _mm_popcnt_u64() and __builtin_popcountll() in the gcc builtins._mm_popcnt_u64() is said to use the CPU introduction...
View ArticleHow to use const int in _Static_assert?
Preamble: I want to statically check amount of struct members in C program, so I created two macros, each of them creates constant int storing __LINE__ into variable: #include <stdio.h> #include...
View ArticleHeader alloca.h in Windows
I can't see any alloca.h equivalent in Visual C 2010. How can one perform stack allocation in Visual C on Windows? I miss the function alloca.
View Article'cmd' is not recognized as an internal or external command while running a...
I am a beginner and i used a YouTube video as my guide to install mingw and gcc and gdb and created a hello.c file and as per the instructions I clicked on "configure default built task" and then...
View ArticleWhat's the main reason for make -t command?
After making a mistake of replying to a post from 2010 (the link to it: What does it mean to 'touch' a target in make? ), i would like to understand something as a new student for C programming...
View ArticleWhy does calling system() without including stdlib.h still work?
The only library I've included in my C program is stdio.h. Calling system() within that very same program works anyway, though Eclipse complains about an implicit declaration of function ‘system’...
View ArticleLua 5.4.4 under msys2 : error loading module 'mylib' from file 'mylib'
Starting from this example i build C mylib.so library in order to call C API function.I use lua5.4.4 building it on my own 'make mingw under msys2' and install it under msys2 /mingw32/bin, /include,...
View ArticleHow to interface to C++ from D correctly?
Today i tried to inteface between C++ and D because i saw this on the official website and wanted to try this.The problem is that i can't compile it, i used the code/command line on the website> g++...
View ArticleC++ #include and #import difference
What is the difference between #include and #import in C++?
View Articlewhy doesn't GCC place a statically-initialized C++ class object into .data
here are two similar declarations of an object type in C++:struct Obj { int x;};struct ObjC { int x; ObjC(int x) : x(x) {};};Obj obj1 = {100}ObjC obj2(200);using a recent version of gcc...
View ArticleAutomake configure wrong target type aarch64-unknown-linux-gnu
I'm trying to (cross)compile my automake project, which is originally developed for linux/x86_64, within a docker container running on an Apple Macbook with M1 chip.The docker host (mac) is version...
View ArticleWhat does this GCC error "... relocation truncated to fit..." mean?
I am programming the host side of a host-accelerator system. The host runs on the PC under Ubuntu Linux and communicates with the embedded hardware via a USB connection. The communication is performed...
View ArticleErrors after updating to GCC 12
I have a project where I'm using the datetimepp library and it has been working fine. However I recently did a pacman -Syu and updated gcc. I then compiled the project (which had been compiling...
View ArticleCompile multiple C source fles into a unique object file
I have some C source files and I am using gcc. I basically want to compile all of them and create one single object file. When I try:gcc -c src1.c src2.c src3.c -o final.oI get:gcc: cannot specify -o...
View ArticlePerformance differ significantly when inner loop iterates less times?
I wrote a toy program that compares the performance of two very similar functions. The entire file (minus a couple of macros) looks like this:constexpr int iterations = 100000;using u64 = uint64_t;//...
View ArticleC/C++ with GCC: Statically add resource files to executable/library
Does anybody have an idea how to statically compile any resource file right into the executable or the shared library file using GCC?For example I'd like to add image files that never change (and if...
View Article