Reading an update across threads
In my application, I have a block of shared memory, which one thread periodically writes to, and another thread periodically gets (and then sets to 0)Thread 1:@onevent:__atomic_store(addr, val,...
View ArticleRISCV inline assembly compilation
To start with optimizing my code I have to start with adding assembly code into my C which is crosscompiled with gcc riscv toolchain, to start with I trying to implement simple riscv inline as...
View ArticleWhat is unlocked_stdio in C?
So, I was looking for random linux manual pages, when I encountered this weird one, you can see it by executing "man unlocked_stdio", or you can view it in your browser by going to this pageSo, what is...
View ArticleIs [[nodiscard]] any different from [[gnu::warn_unused_result]]?
I had some code that used the GCC extension [[gnu::warn_unused_result]] (a.k.a. __attribute__((__warn_unused_result__))). Now I attempted to use C2x's [[nodiscard]] and I got an incomprehensible error....
View Articlebad defsym; format is --defsym name=value
Explanation: I've created an STM32 project and aim to get a platform-independent build and output file like .hex, .bin, and .elf. For this, I created the project under the CMake build system. CMake...
View ArticleHow to use GCC PGO with source code in different folder?
I've compiled PGO-instrumented build from A/src and collected the profile. Now I want to apply this profile when building from B/src. Is this possible? GCC complains about the lack of profile since...
View ArticleCan't install cargo-binutils library: Failed to find tool. Is `gcc.exe`...
When I run cargo install cargo-binutils, I get the below error. I have gcc installed and in my path, to the point where where gcc correctly returns the location. gcc version: gcc.exe...
View Articlerpc/rpc.h file not found on windows
I am working on sunrpc library developed by Sun Microsystems on windows.I have downloaded GnuWin32 sunrpc4.0 on windows 10.I am running rpcgen -a -C -Y "C:/MinGW/bin" add.x command and I am able to get...
View Articleusing C copy a 1D char array into 2D char array
I am trying to copy a 1D array of Strings into a 2D array of strings in C.I was able to achieve this with integerenter image description here//Here is what I tried for integers. int main() { int...
View ArticleLarge header file vs compilation time [closed]
Im working on a large project, my issue is as follows:I have a large (200k lines of code) header file which is auto generated code, it contains about 3k classes (all of them are small classes).And the...
View ArticleHow can I tell, with something like objdump, if an object file has been built...
How can I tell, with something like objdump, if an object file has been built with -fPIC?
View ArticleWhen GCC does not provide __cpp_lib_uncaught_exceptions feature?
Following piece of code does not work right on Alpine Linux:#ifndef __cpp_lib_uncaught_exceptionsnamespace std { int uncaught_exceptions() noexcept { return std::uncaught_exception();...
View ArticleHow to pass comma-separated options to the g++ linker with VSCode?
I need to pass the arg -Wl,-Bstatic,--whole-archive to g++. "version": "2.0.0","tasks": [ {"type": "shell","label": "shell: g++.exe build active file","command": "C:\\MinGW\\x86\\bin\\g++.exe","args":...
View ArticleGCC compound literal in a C (GCC C11) Macro
After understanding that GCC supports Compound Literals, where an anonymous structure can be filled using a {...} initaliser.Then consider that gcc accepts (with limitations) variable length structures...
View ArticleCompiler Error in Rcpp: "fatal error: stdlib.h: No such file or directory...
I have updated Xcode and MacOS operating system to Monterey and now I am having a series of issues of making Rstudio to work as used to do.In particular, now I am getting an error when I try to source...
View ArticleIs ar rcs in GCC a valid translation of link /lib in CL?
I have this command on Windows:A.objlink /lib /out:B.lib A.objI want to do exactly the same but with GCC 4.8.5 in LinuxI tried withA.oar rcs B.a A.oand it is generating a static library but i´m not...
View ArticleHow to install an older version of gcc on Fedora
I tried to install CUDA on Fedora 31 but got stuck at the last step because CUDA officially supports Fedora 29 (gcc 8.2) while the version shipped with Fedora 31 is 9.2, I then installed Pytorch with...
View Articlec++ vector.push_back error: request for member 'push_back'..., which is of...
I'm using Cygwin with GCC, and ultimately I want to read in a file of characters into a vector of characters, and using this code#include <fstream>#include <vector>#include...
View ArticleC++ NVCC/gcc disable ALL warning for some lines of code? [duplicate]
__host__ __device__ inline uint32_t __attribute__((always_inline)) RowMajorMatrixIndexer32( uint32_t row, uint32_t col, uint32_t nrow, uint32_t ncol) { return row * ncol + col; } __host__ __device__...
View ArticleUsing gcc to compile a c++ program for linux linking static and dynamic...
I'm trying to compile a program using a makefile and gcc as compiler.I must link my program with static and dynamic libraries. I've linked the static libraries as follows:the name of my static...
View Article