Quantcast

How do I statically include libgccjit?

I've just compiled GCC from source, which gave me a libgccjit.so file to dynamically include from my program. However, perhaps I wouldn't want to bundle the file alongside the program if I were to give...

View Article


Gcc flag repetition of -Wl what does the linker actually do

I am currently working with a project that generates its compiler- and linkerflags by reading a configuration file.The resulting linker-flags of interest...

View Article


What is the best way to specify include path in makefile?

Include path can be specified either through a -I key or through an environment variable C_INCLUDE_PATH.It seems to me that using a variable is better, since in the case of a key it is necessary to...

View Article

How to find out which optimizations are actually applied when using gcc?

With IBM's XL compiler family it is possible to supply two options (-qreport and -qlist) to generate reports for each source file that include information on which optimizations were applied, or which...

View Article

Disabling sanity checks in generated jump tables

Consider the following switch construct. This simply switches on a variable x and prints a number.switch (x){case 1:printf("1");break;case 2:printf("2");break;case 3:printf("3");break;case...

View Article


Undefined Reference to std::condition_variable::wait in ORB_SLAM3 with OpenCV...

I'm encountering a linker error when building the ORB_SLAM3 project, which is linked against OpenCV 4.9.0 built from source using GCC 9.4.0 on Ubuntu 18.04. The error occurs when trying to link the...

View Article

Header search paths with gcc using C_INCLUDE_PATH

i'm confused about the following include files(with GCC)i've A.c and B.c in folder AAAand B.h in folder BBBin A.c:#include <stdio.h>#include "B.h"main(){ errPrint();}in B.c:#include...

View Article

undefined reference to `Py_Initialize' when build a simple demo.c on a Linux...

I am testing of running a Python thread in a c program with a simple example like the below# demo.pyimport timefor i in range(1, 101): print(i) time.sleep(0.1)// demo.c#include <Python.h>#include...

View Article


GCC recommends a strange implementation for max macro

so , I was reading GCC documentation until I reached Statements and Declarations in Expressions section 6.1 , follow this link to reach the section I am talking about.I came to these strange lines...

View Article


Image may be NSFW.
Clik here to view.

Why % is always appended in c printf statement in mac zsh terminal? [duplicate]

I'm learning to program in C using VS Code in MacBook, if I print Hello world in terminal I'm getting % magically appended to my print statement (ie., Hello world%).Does anyone know,Why this is...

View Article

GCC vs Green Hills on ARM

I'm interested in any comparisons between GCC and the Green Hills C compiler with regard to memory footprint of the generated code, specifically on ARM platforms.Are there any benchmarks or comparisons...

View Article

GCC can't find sstream header? [closed]

I tried coding graphics with opengl, and I wanted to read a shader file and put it in a String.the command is here:g++ -o main.o -c -Iglew/include -Iglfw/include main.cppand I got this...

View Article

How to specify the function-attribute general-regs-only

I wanted to get rid of the compiler warning warning: FP registers might be clobbered despite 'isr' attribute: compile with '-mgeneral-regs-only' [-Wattributes], so I tried to add the function attribute...

View Article


Are identically named members of unnamed structs in a union an error or a GCC...

The below code can be compiled successfully in Visual C++. I like it and it is sweet!#include <stdio.h>#ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4201) #pragma pack(push,1)...

View Article

stdint.h include_next'd from stdint.h not found

I have been putting together a m68k cross compile "environment/toolchain" of sorts for some upcoming projects I have planned, and I'm having an issue when using it on macOS (my native environment)...

View Article


Equivalents to MSVC's _countof in other compilers?

Are there any builtin equivalents to _countof provided by other compilers, in particular GCC and Clang? Are there any non-macro forms?

View Article

How to build a simple C++ application with macos CoreFoundation? [duplicate]

I try to build a simple C++ application that has dependency on mac os CoreFoundation. This is an application code snippet:#include <iostream>#include <vector>#include <string>#include...

View Article


How to exclude a function from Gprof activity during running

Suppose i have function foovoid foo(){ //do something}Now this fn foo is now called by other function defined in other files. if gprof is enabled it would do profiling activity and subroutines for this...

View Article

Unable to use std::format for integer formatting - gcc 15.1.0

I am using gcc 15.1.0 docker image. I was running my C++ code but I encountered a very weird issue that I am unable to resolve. Attaching the minimal reproducer (I can't remove the import inside...

View Article

gcc, enum is not packed as expected

The size of enum is not packed, why is that?typedef enum{ STATE_IDLE = 0, STATE_RUN,}State_t;#pragma pack(1)struct { char c; //1 State_t State; // should be 1 but is 4 uint32_t Time; //4 sCB_t CB;...

View Article

Image may be NSFW.
Clik here to view.

Why do I get the same address every time I build + disassemble a function...

Every time when I disassemble a function, why do I always get the same instruction address and constants' address?For example, after executing the following commands,gcc -o hello hello.c -ggdbgdb...

View Article


Compiling some C++ code simple module using clang/gcc

I was trying for sake of practice to compile a small module using clang (which is the compiler I have in hand at the moment).My module code is://basic_math.cppexport module basic.math; //Notice module...

View Article


Why does clang not produce an error with an exhaustive switch case is used to...

Consider the following code:enum class E { ONE = 1, TWO = 2};int foo(E e) { switch (e) { case E::ONE: return 1; case E::TWO: return 2; }}The C++ standard allows enum classes to have values that are...

View Article

Why won't this compile prior to GCC 14.1? [duplicate]

This compiles for me on MSVC and Clang but not on GCC before version 14.1, which was really recently, like May 2024.template <typename key_t>class KeyValueDatabase{public: KeyValueDatabase()...

View Article

Compiler is out of heap when compiling recursive consteval function

I'm writing a compile-time parser PoC (compiling a literal string to std::tuple) based on C++20 (or 23 if necessary). Currently gcc, clang, and MSVC all crash for this code, and MSVC gives useful...

View Article


Vector in C++ module causes useless Bad file data GCC output

TL;DR:GCC 11.2.0 (image f7ea55625e09)+ C++20 +<vector>'s std::vector<anything> cause useless output. How to get out something I can work with?Compilation works in:module cachesingle...

View Article

Image may be NSFW.
Clik here to view.

Understanding different translation units in C (the meaning)

While learning storage classes in C, I stumbled upon something called Linkageand the following site cpp.referencedescribes linkage with translation units not in terms of a source file (.c file, what I...

View Article

How to fix the header file issue with Homebrew gcc after MacOS 15.4 Sequoia...

After the MacOS 15.4 update, my C++ code, which used to compile perfectly fine on my Homebrew gcc install, stopped working. After a bit of internet search, it seemed like Apple did something weird with...

View Article

Why does pointer != NULL, but prints as (nil) with %p format specifier?

I'm experiencing an unusual issue in my C program where a pointer that is checked to be not NULL prints as (nil) when using the %p format specifier.Here's a simplified version of my code:#include...

View Article



GNU LD: How to override a symbol value (an address) defined by the linker...

My usecase is as follows: I am using a typical SDK that comes with Makefile based projectsI belive the linker is patched gcc. gcc --version gives me 4.3.4SDK defines the linker script (lets call it...

View Article


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>