Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Browsing all 21994 articles
Browse latest View live

is there a way to simulate/inject a software error on a C++ program? [closed]

the goal of my application is to simulate the wrong execution of a program (Written in C/C++)by inject a software error like changes the value of the pointer of an array or inject a istruction...

View Article


sscanf() causing infinite loop by changing the index value of for loop

Function:void input_bytes(unsigned char bytes[], int num_bytes){ const int CHAR_PER_BYTE = 2; /* expects hex input */ const int STRING_SIZE = num_bytes * CHAR_PER_BYTE; char input_string[STRING_SIZE +...

View Article


Is it possible to use a different gcc version inside a Conda environment?

I have to install a package which calls for gcc: >=5.3. On my system (Linux, remote server), gcc version is 4.8.5, and a Conda virtual environment uses the same version. Is it possible to use a...

View Article

What is -no-pie used for?

I was working on Ubuntu 17.10 with GPROF for some testing with c files and when i execute with gprof the file generated (gmon.out), compiling and linking with -pg option, i got an empty flat and call...

View Article

Why am I getting "undefined symbol" when I link my static library in my C...

I'm trying to create a static library to allow me to use a C++ API in my C program. To get started, I'm trying to call an API function called APIName::Api_init(); So far, I have created a "wrapper"...

View Article


gcc's assembler and variable type (length, sign)

I'm using an 'm68k-elf-as' compiler (https://gnutoolchains.com/m68k-elf/) for assembly code that I'm patching into my car's ECU (CPU32 ISA, MC68376 processor).Is there a simple way to control...

View Article

Is it possible to write a _Static_assert in GCC/GNU C that would verify the...

Suppose that I have the following definitions:#include <stdbool.h>#include <stdint.h>#define ASSERT(cond) _Static_assert(cond, #cond)typedef union { struct { bool bit0:1; bool bit1:1; bool...

View Article

Does every function get its own stack in c?

I recently learned about stacks, so I was experimenting to see what the stack size is and what happens when it overflows. I found out that on Unix the default stack size is 8 MiB, and that supports my...

View Article


Inject a fault in a C++ source code for testing reliability of a system [closed]

My goal is to create a system able to take a c/c++ source code or conpiled code as input and inject errors runtime and take informations for statistical purposes.I'm taking care of soft errors, it...

View Article


Image may be NSFW.
Clik here to view.

CMake Error: configure_file Problem Configuring File - with CLion

I am trying to setup my CLion on Windows with WSL, following the official tutorial: https://www.jetbrains.com/help/clion/how-to-use-wsl-development-environment-in-clion.htmlWhen setting up the...

View Article

CODEBLOCKS : a function-definition is not allowed here before '{' [closed]

#ifndef ISVALID_H_INCLUDED#define ISVALID_H_INCLUDEDint is_valid_name(char* c){ //ERROR IS HERE for(unsigned int i = 0; i < strlen(c); i++) { /// first character if(!strcasecmp(&c[0], "_") ||...

View Article

What is a good way to apply multiple sanitizers in cmake with gcc

GCC has many sanitizers (e.g., leak, address, thread). But many of them require instumentation of the code and cannot be used together with others. So if in practice I want to apply all the sanitizers...

View Article

Conditional Preprocessor macro expansion in C

I have a macro, SOME_MACRO. It takes an argument.Definition of SOME_MACRO:#define SOME_MACRO(arg) __SOME_MACRO(arg)Further I want __SOME_MACRO(arg) to expand to "ABC" if arg is 0. And if arg is not...

View Article


Why do I get a warning every time I use malloc?

If I use malloc in my code:int *x = malloc(sizeof(int));I get this warning from gcc:new.c:7: warning: implicit declaration of function ‘malloc’new.c:7: warning: incompatible implicit declaration of...

View Article

"stderr;" as a statement throws no warning

Suppose I have a source code like this:#include <stdio.h>FILE *p;int main(void) { p;}... which will compile (using gcc) without any errors or warnings – unless I turn on -Wall, in which case a...

View Article


Image may be NSFW.
Clik here to view.

C compiler not noticing errors and correcting code itself

So I am a beginner in C and I have been following a book Primer Plus 6th edition.While I was running my program I noticed something really strange, compiler is not working as it is supposed to, for...

View Article

gcc android cross compiling libgcc crtbegin_so.o crtend_so.o error

I trying to build a gcc cross compiler for target arm-linux-androideabi from Ubuntu 20.04 LTS machinetutorial page https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/target sourcesbinutils...

View Article


Why for gcc 'UNIX' and 'unix' macros are not the same thing?

I have a weird problem with gcc in Ubuntu Mate. I need to write a golang program which uses a third-party C library, but i'v run a problem.When I try to connect the third-party library in this code:...

View Article

Simple coroutine leaking with GCC 10

Consider the following simple coroutine, which tracks its construction and destruction:#include <coroutine>#include <iostream>struct simple { static inline int x = 0; int id = 0; simple() :...

View Article

"implicit declaration of function" in utarray.h (part of uthash)

I'm using utarray (part of the uthash library) for a project. Whenever I include it, I get the following error:utarray.h:221:3: error: implicit declaration of function ‘strdup’...

View Article
Browsing all 21994 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>