Why is the compiler throwing this warning: "missing initializer"? Isn't the...
I'm creating some sort of frontend for a program. To launch the program I'm using the call CreateProcess(), which among other things receives a pointer to a STARTUPINFO structure. To initialize the...
View ArticleLinux 64bits : cross-compile for 32bits target using cmake
I'm using gcc+cmake in a Linux 64bits and my compilation target is Linux 32bits.So I added -m32 to my CMAKE_C_FLAGS.But then cmake fails with the message: The C compiler "/usr/bin/gcc" is not able to...
View ArticleWhy doesn't gcc call abs function?
I have some C code#include<stdio.h> #include<stdint.h> int32_t abs(int32_t x) { int32_t mask = (x >> 31); printf("mask is %d\n",mask); return (x + mask) ^ mask; } int main(int argc,...
View ArticleWhy is the address of a nested function (GNU extension) in GCC considered...
The GNU C compiler contains a nice extension to the C language, called Nested Functions. However, the documentation is unclear in some points. For example, it says thatIt is possible to call the nested...
View ArticleHow to disable relro to overwrite fini_array or got.plt element
I am reading the book Hacking: The art of exploitation and there is a format string exploit example which attempts to overwrite an address of the dtors with the address of a shellcode environment...
View ArticleIs it required to free pointers in C when using default gcc compiler in...
If the dynamically allocated pointers are not freed in C when using the default gcc compiler in linux, will it cause problems in system?
View ArticleOpenMP: "libgomp: Thread creation failed: Resource temporarily unavailable"...
When I run the following example code:#include "stdio.h" #include <omp.h> int main(int argc, char *argv[]) { #pragma omp parallel { int NCPU,tid,NPR,NTHR; /* get the total number of CPUs/cores...
View ArticleWhy the FFT function can only be activated through the Preprocessor of MCU...
As introduced in many website, if we want to active the FFT/FPU of the STM32 board, then we have to active:__FPU_USED=1; __FPU_PRESENT=1; ARM_MATH_CMx.Instead of typing these words in the Preprocessor...
View ArticleDerived class does not see public members of its base class [duplicate]
Why doesn't the following code compile with GCC (versions 7,9,11)?template <class V> struct Serializer { bool serializeStructIndex = true; }; template <class V> struct Reader : public...
View ArticleRemoving trailing newline character from fgets() input
I am trying to get some data from the user and send it to another function in gcc. The code is something like this.printf("Enter your Name: "); if (!(fgets(Name, sizeof Name, stdin) != NULL)) {...
View ArticleWhat are the differences between C++ Toolchains and Compilers?
I know there are many compilers like gcc, clang, ninja but I keep hearing about "Toolchains" and so on but I don't understand what they are, like "gnu-toolchain' etc
View Articleg++ with -m32 --coverage profile .gcda: Cannot open
When I'm trying to compile my C/C++ software using gcc/g++ with -m32 option on RedHat 6.10 which is a 64bit OS, we have a Dell isilon file system exporting 64 bit file ID's we get a run-time error...
View Articlelibcryptopp.a(misc.h) undefined reference to symbol libc++.so.1 Problem...
/usr/local/bin/ld: ../../../Extern/lib/libcryptopp.a(misc.o): undefined reference to symbol '_ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6resizeEjw' /usr/local/bin/ld:...
View ArticleVS Code will not build c++ programs with multiple .ccp source files
Note that I'm using VS Code on Ubuntu 17.10 and using the GCC Compiler.I'm having trouble building a simple program which makes use of additional .ccp files. I'm probably missing something obvious here...
View ArticleBootstrapping Bazel for Raspberry Pi 4 failed, jni_md.h not found
I'm currently trying to compile the latest version of Bazel (2.2.0) from source on a headless Raspberry Pi 4 that has Raspbian Buster installed. I was using this page as an installation guide.I had no...
View ArticleHint the C compiler (GCC or Clang) of possible variable value/range [duplicate]
In the following code, only one comparison will be done, because the compiler knows the conditions are exclusive and we will always enter the second condition as bar will be necessary > 32:int...
View Articlec header-guards are ignored?
Why does gcc ignore these header guards in this simple test program?The header file is:#ifndef MYHEADER_H #define MYHEADER_H #warning "header declared" int some_int=0; #endif And the two .c files are:...
View ArticleC - Optimization Boundary with Inline Assembly?
Consider following code:// String literals #define _def0Impl(a0) #a0 #define _def0(a0) _def0Impl(a0) // Labels #define _asm_label(tag) tag: asm volatile (_def0(tag) ":") // Assume 32 bits typedef...
View ArticleCompile C source files from tree into build directory with make
I have a Makefile that looks similar to this condensed version:.PHONY: all CC = gcc -O3 -fPIC SRC = $(shell find src -type f -name '*.c') OBJ = $(addprefix build/, $(notdir $(SRC:.c=.o)) TGT =...
View ArticleDifferent ways of suppressing 'uninitialized variable warnings' in C
I have encountered multiple uses of the uninitialized_var() macro designed to get rid of warnings like:warning: ‘ptr’ is used uninitialized in this function [-Wuninitialized] For GCC...
View Article