How to fix broken gcc compiler in conda
I am trying to compile some software that contains a compile.sh shell script. When I run the script, the software fails to compile due to what it reports as a broken C compiler.I have tried...
View ArticleNested lambda and mutable keyword
Consider the following piece of code:void f() { int a = 3; [=]() { [=] () mutable { a = 5; }(); }(); } It compiles on Clang (https://godbolt.org/z/IEXotM) but not on GCC (https://godbolt.org/z/xWXFe6)....
View Articleinstalling a GCC compiler onto a Docker Container
I am trying to install mono package onto a Docker container, but mono requires git , autoconf, libtool, automake, build-essential , mono-devel, gettext packages.the problem I am having is that libtool...
View ArticleHow to calculate text, rodata, data and bss sizes of one module in C?
In my project, I first compile aa_1.c, aa_2.c... from folder A, then compile bb_1.cbb_2.c... from folder B. Then I use gcc-ar to generate libapps.a. At last, I link with other static libraries. Now I...
View ArticleHow to load address of function or label into register in GNU Assembler
I am trying to load the address of 'main' into a register (R10) in the GNU Assembler. I am unable to. Here I what I have and the error message I receive.main: lea main, %r10 I also tried the following...
View ArticleCan and does the compiler optimize out two atomic loads? [duplicate]
This question already has an answer here:Why don't compilers merge redundant std::atomic writes? 9 answersCan atomic loads be merged in the C++ memory model? 2 answersWill the two loads be combined to...
View ArticlePrevent gcc from mangling my AVX2 intrinsics copy into REP MOVS
Consider the following loop:template <typename T> void copytail(T* __restrict__ dest, const T* __restrict__ src, size_t count) { constexpr size_t chunk_size = 4 * 32; size_t byte_count =...
View ArticleHow to include unused function in gcc
I am using g++ as my compiler for c++ code. I am creating a coverage report using lcov. I found that in coverage report unused functions are not even marked with count 0. Is there any way to solve this?
View ArticleMSYS2 on Windows 10 With Glade ( gtk_entry_get_text: assertion 'GTK_IS_ENTRY...
Unfortunately I'm new to programming in C and I'm experiencing many problems with external libraries compatibility between linux and windows.I'm trying to learn how to use GTK 3, use Glade to create...
View ArticleValgrind reports memory leak on freed pointer after getline from stdin
Having this code:#include <stdlib.h> #include <stdio.h> void main() { char *line = calloc(1024, 1); size_t size = 0; getline(&line, &size, stdin); free(line); } Valgrind...
View ArticleHave some troubles to use lib installed with vcpkg in vscode and gcc
I'm a beginner in C and I want to use a lib called json-c. So I followed the git tutoriel and I installed vcpkg. After that I run the command:vcpkg install json-c vcpkg integrate install So now vscode...
View ArticleI get a segmentation fault when trying to read a file
I've looked up on how to use fgets function and hence I wrote this code:#include <stdio.h> void main(int argc, char** argv) { if (argc == 2) { FILE* file = fopen(argv[1], "r"); if (file != NULL)...
View ArticleCalling the qsort() function
I'm writing this program which needs to do a qsort() on a table. I've done extensive research on the internet, but I'm still missing something. Below is selected portions of the source code.#define...
View ArticleHow to configure mingw to search libs?
I'm trying to compile my program for windows, i'm using mingwi686-w64-mingw32-gcc Pagina_inicial.c -o Pagina_inicial `pkg-config --libs --cflags gtk+-2.0 mysqlclient` but only the --cflags was find,...
View ArticleHow to generate gcc debug symbol outside the build target?
I know I can generate debug symbol using -g option. However the symbol is embeded in the target file. Could gcc generate debug symbol outside the result executable/library? Like .pdb file of windows...
View Article"Error: this statement may fall through" when compiling from source
I'm trying to compile OpenOCD 0.10 from source, but when running make I getlibtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src -I./src -I./src/helper -DPKGDATADIR=\"/usr/local/share/openocd\"...
View ArticleHow to integrate WinBuild and VS Code?
I am trying to compile C++ using VS code and WinBuild (yypkg), is this possible?I have downloaded MinGW, GCC and G++, and the include folder checks out.Reference or step my step instruction would be...
View ArticleAsk gcc to print error locations without dir, just the filename
How to make gcc print error locations without the directory name, using just the filename itself. For example, instead of:$ gcc input.c /home/oren/some/very/very/long/dir/input.c: error exponent has no...
View ArticleUndeclared variable in a cross compiled root filesystem
So I'm cross compiling a Linux root file system basically from scratch. I was able to get all the basic software cross compiled using a very basic toolchain from scratch. Below is the list of some of...
View ArticleUnexpected value appears on stack when attempting buffer overflow
I am trying to learn more about cyber security, in this case about buffer overflows. I have a simple code that I want to change flow of:#include <stdlib.h> #include <unistd.h> #include...
View Article