Skip to main content

New answers tagged

0 votes

How to use GCC with Microsoft Visual Studio?

Install MSYS2. Install GCC by MSYS2 MSYS shell by running the following commands. pacman -Syu pacman -S --needed base-devel mingw-w64-x86_64-toolchain Add these directories to the system environment ...
Hysaam Riad's user avatar
0 votes

Compiling C and C++ files together using GCC

As mentioned in a couple of comments by Gabriel Devillers (1, 2), you could use g++ en lieu of gcc for a one-liner, by using -x c and then specifying the .c files afterwards, like so: g++ -std=c++0x -...
Greenonline's user avatar
  • 1,405
0 votes

Why does GCC compiled code fail on modifying a thread_local std::deque?

Try light compiler optimization -Og In my environment, I see a crash with uninitialized std::deque memory when CMAKE_BUILD_TYPE=Debug . No crash is observed when building with CMAKE_BUILD_TYPE=...
pmarquis's user avatar
0 votes
Accepted

error: ‘format’ attribute argument 3 value ‘7’ does not refer to a variable argument list

I posted it in GCC Bugzilla. The short answer is: format does not work with variable templates type. It only works with variable argument list. The documentation should make this clear. I found for ...
Peter VARGA's user avatar
  • 5,371
5 votes
Accepted

Why does ARM GCC push / pop scratch register R3 in a tiny function?

This is probably for stack alignment. The AAPCS calling conventions require 8-byte stack alignment at a "public interface", which means on entry to a function. So the stack pointer must ...
Nate Eldredge's user avatar
2 votes

Why doesn't GCC on Linux produce "undefined reference to `__gcov_xxx'" (while GCC on Windows does)?

Part of answer by user Brecht Sanders: Also, on Windows you can't build shared libraries (.dll) or executables (.exe) with unresolved symbols. Part of "DLL hell" is that you must make sure ...
pmor's user avatar
  • 6,919
1 vote
Accepted

Why does impure_data still exist with GCC -fno-math-errno

Specifying -nostdlib -lc fixed the issue whether -g is provided or not. The assumption is that these options replace libg.a with libc.a, allowing the -fno_math_errno option to be considered. As to why ...
0 votes

GCC left shift overflow

For right shift, it would be safe to write division instead. I would assume that if there is a sufficient instruction, compiler would optimise it out anyway, replacing with a platform specific ...
sfasfdsaf's user avatar
0 votes

Is there a 128 bit integer in gcc?

Starting with C23, you can use the _BitInt(128) and unsigned _BitInt(128) types for signed and unsigned 128-bit integers, respectively. However, these types are not mandatory; they only exist if ...
Jan Schultke's user avatar
  • 45.1k
Advice
0 votes
0 replies
0 views

gcc: "SET_TYPE_STRUCTURAL_EQUALITY"

I passed (essentially) my question to the AI Assistant in the new interface to Stack Overflow. This was VERY helpful. Thank you. Jørgen
Jørgen Steensgaard's user avatar
0 votes

How to get GCC to inline strcpy (string copy)

Another option - which can be relevant for the cases that the actual strcpy are for short string, and the benefits of the avoiding the calls is significant - is to implement "light weight" ...
dash-o's user avatar
  • 14.7k
0 votes

How to get GCC to inline strcpy (string copy)

For string of unknown length - inlining strcpy can be complex - different strategies can optimized for different cases (long string, vs short string, different architecture, ...) It's easier to get ...
dash-o's user avatar
  • 14.7k
1 vote

Is there a direct way to get clear details on gcc acceptable option values (e.g. for -std) without grep-ing through irrelevant material?

gcc and g++ don't offer an option to list available standards, but there is a nice trick to get them all. Type g++ -std= in a terminal and press tab, and it will list available options: $ g++ -std= c++...
BЈовић's user avatar
  • 64.8k
Advice
0 votes
0 replies
0 views

gcc: "SET_TYPE_STRUCTURAL_EQUALITY"

A simple example might suffice.
Jørgen Steensgaard's user avatar
Advice
0 votes
0 replies
0 views

gcc: "SET_TYPE_STRUCTURAL_EQUALITY"

A simple, real-life example would probably help a lot.
Jørgen Steensgaard's user avatar
Advice
0 votes
0 replies
0 views

gcc: "SET_TYPE_STRUCTURAL_EQUALITY"

Additional info: The term 'macro' is used in various descriptions of similar directives, so I tried to see if the mentioned could be used literally, but GCC's preprocessor took it for an ordinary name....
Jørgen Steensgaard's user avatar
Advice
0 votes
0 replies
0 views

gcc: "SET_TYPE_STRUCTURAL_EQUALITY"

It isn't quite clear what kind of help you expect.
n. m. could be an AI's user avatar
3 votes
Accepted

Resolving circular dependency in modules

Remove unnecessary #include and forward declarations from header files. Add #include to those files only that miss identifiers. #endif of include guards must be last lines. Constants in header files ...
3CEZVQ's user avatar
  • 44.3k
1 vote
Accepted

Can't get my custom context switch working with arm inline assembly

The problem was caused because I made the PSP register point at the task stack. This caused data corruption, and the processor couldn't switch to the tasks. Instead of pointing at the task stack, I ...
Clyde Xander's user avatar
1 vote

-Wextra-semi is not supported in gcc?

-Wextra-semi was added to GCC in major-version 8; its documentation was moved to C++ Dialect Options. It is available in all newer versions of GCC (latest I could check at time of writing is 15.2).
julaine's user avatar
  • 2,792
Advice
0 votes
0 replies
0 views

G++ Not recognizing .bin file as input

omg im dumb lol. Sorry I'm super new to all this. Thank you!
Phoenix's user avatar
Advice
0 votes
0 replies
0 views

G++ Not recognizing .bin file as input

If you trying to compile mippsim.cpp, you don't need the .bin file. If you are trying to run mippsim, you don't need g++. Having both g++ and the .bin file in the same command doesn't make much sense. ...
n. m. could be an AI's user avatar
2 votes

How do I call "cpuid" in Linux?

With GCC there is no need to invoke cpuid from inline assembler, because it provides the __get_cpuid_count() and __get_cpuid() intrinsics via cpuid.h. __get_cpuid_count() is more generic as it also ...
maxschlepzig's user avatar
  • 40.4k
Tooling
0 votes
0 replies
0 views

How can I get a truly portable GCC toolchain with multilib support that runs on any Linux distribution without system dependencies?

@ValdikSS Thanks for the suggestions! I actually built a solution that addresses the portability limitation you mentioned—it's truly distribution-agnostic and relocatable. I've posted the details in ...
Prem Kumar's user avatar
Tooling
0 votes
0 replies
0 views

How can I get a truly portable GCC toolchain with multilib support that runs on any Linux distribution without system dependencies?

Yes, it's possible to create a truly portable GCC toolchain. After weeks of trial and error, countless build failures, and debugging mysterious linker errors, I finally figured out how to build ...
Prem Kumar's user avatar
0 votes

GNU linker script - how to automatically distribute code to multiple dis-contiguous sections

Credit to @KamilCuk for identifying my duplicate question and suggesting a way to achieve what I, and by the sound of it you, want to achieve (he has declined to respond to my suggestion he post it as ...
RidiculousRichard's user avatar
Advice
0 votes
0 replies
0 views

How can I use gcc linker (for 'C' code) to automatically fit variables around reserved addresses

FYI, I've had success with the following algorithm: Compile all translation units into object files. Have a fake memory contiguous memory layout to link into to get a good estimate of the final ...
RidiculousRichard's user avatar
Tooling
0 votes
0 replies
0 views

How can I get a truly portable GCC toolchain with multilib support that runs on any Linux distribution without system dependencies?

Take a look at how e.g. Linaro toolchain is built: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads It doesn't have any path requirements. I believe crosstool-ng also builds path-...
ValdikSS's user avatar
  • 248
1 vote
Accepted

Compiler errors related to avx512 when upgrading from Eigen 3.4.0 to 5.0.0 on x86-64 RHEL cluster

The compiler you are using doesn't have support for that intrinsic, which began appearing in Eigen in the 5.0 release series. For GCC, support was added in the GCC 10 series. For Clang, it appears to ...
irowe's user avatar
  • 720

Top 50 recent answers are included