Category "gcc"

how to find the dependencies of a source code?

Let say I have a simple c-library project, the layout is as follows - src/ - square_root.c - log.c - power.c - newton_method.c - include

Why can't local variable be used in GNU C basic inline asm statements?

Why cannot I use local variables from main to be used in basic asm inline? It is only allowed in extended asm, but why so? (I know local variables are on the st

Using operator ""s for std::chrono with gcc

I want to use the std::chrono::duration literals, such as 10s to mean "10 seconds", like this: std::chrono::duration<uint64_t, std::milli> millisecs = 10s

Can anyone explain how to use OpenACC in GCC?

I am using WSL Ubuntu. And use GCC to compile my C++ code. I am trying to use OpenACC to parallelize my code. I heard that I can use OpenACC with GCC. So after

Eclipse can't find linked libraries

I am working with the windows.h functions and everything works fine so far. But when I try to use functions which require me to link external libraries somethin

VisualStudio2022 can't navigate from compile error to source

I'm using VisualStudio 2022 community to develop linux program. The cross-platform compile do works and compile outputs shows Output view well. But when double

Cygwin: C standard library does not support TIME_UTC and timespec_get?

Sample code (t667c.c, taken from here): #include <stdio.h> #include <time.h> int main(void) { struct timespec ts; timespec_get(&ts, TIM

Does GCC support C++20 std::format?

If it doesn't, do you know what compiler or version will? See cppreference/format.

strdupa() implementation for Visual C

I am trying to port a C (not C++) program from GCC to Visual Studio. The GCC specific function strdupa() is widely used in this program. Is there any way to imp

Installing Ta-lib creates gcc error

I am getting gcc error when trying to install Ta-lib as a global package on my mac. I get an error below: gcc -Wno-unused-result -Wsign-compare -Wunreach

Why don't compilers optimize trivial wrapper function pointers?

Consider the following code snippet #include <vector> #include <cstdlib> void __attribute__ ((noinline)) calculate1(double& a, int x) { a += x

Attempting to compile with my own static C library

I compiled a static library. I have two files. mylib_1.c with function foo1 in it mylib_2.c with function foo2 in it. Both #include "mylib.h". I compiled a libr

Cross Compile zlib for ARM

I try cross compile zlib for arm-poky-linux-gnueabi but I've an error when I launch make : ...:~/zlib-1.2.11$ AR=$HOST-ar CC=$HOST-gcc RANLIB=$HOST-ranlib ./co

Cross Compile zlib for ARM

I try cross compile zlib for arm-poky-linux-gnueabi but I've an error when I launch make : ...:~/zlib-1.2.11$ AR=$HOST-ar CC=$HOST-gcc RANLIB=$HOST-ranlib ./co

Why are the results of the optimization on aliasing different for char* and std::string&?

void f1(int* count, char* str) { for (int i = 0; i < *count; ++i) str[i] = 0; } void f2(int* count, char8_t* str) { for (int i = 0; i < *count; ++i)

What do the values of the C++ "feature test macros" mean?

To test for a feature, cppreference mentions these feature test macros: link. If the feature is present in the compiler, the macro is defined. But I don't unde

Error building program using gcc plugin from linux kernel source tree

I am trying to use a grsecurity gcc plugin that I found on their unofficial linux kernel source tree (the respectre_plugin/ one). My GCC version is 4.7, I modif

Compiling c++ OpenACC parallel CPU code using GCC (G++)

When trying to compile OpenACC code with GCC-9.3.0 (g++) configured with --enable-languages=c,c++,lto --disable-multilib the following code does not use multipl

Would the compiler optimize this for loop?

In C or C++, if the compiler encounters a for loop in which a counter is counting from 0 to n, and n is a variable (not a function call, and NOT A CONSTANT eith

gcc cross compiling for raspberry pi /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.34' not found

On Ubuntu 22.04 LTS, I'm cross-compiling for raspberry pi. When I run any built executable on the pi, I get this linking error: /lib/arm-linux-gnueabihf/libc.so