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

cannot open output file a.out: Permission denied, on a simple compilation

I wrote some code in vim and whenever I try to run the code it shows this:coolmego@coolmego-PC:~/coolmego/cprograms$ gcc dfs8puzz.c /usr/bin/ld: cannot open output file a.out: Permission denied...

View Article


Embed revision number in executable binary

I want to embed a git revision marker in my binary, but the linker appears to strip it away.Makefile:CPPFLAGS += -DREV=$(shell git describe) file.c:#define xstr(s) str(s) #define str(s) #s const char...

View Article


How do I use bcrypt in c++ under Linux using wrapper libbcrypt

I try to write a simple login script using bcrypt. I've tried to use the C wrapper libbcrypt library - https://github.com/trusch/libbcrypt - but got stucked with the compiler complaining about...

View Article

gcc FORTIFY_SOURCE drastically increases binary size

We have a very large C++ codebase that we would like to compile using gcc with the "FORTIFY_SOURCE=2" option to improve security and reduce the risk of buffer overflows. The problem is when we compile...

View Article

Create stub library/object from application code (ROM) using binutils for...

I have some C code that is implemented in a ROM. I'd like to link an application against that code, so I can save some space (as my application won't have to include the ROM code as it's already in the...

View Article


Statically linking libc into my binary causes it to segfault

I need to build a binary with libc statically linked. I have libc.a available in the same directory as the source code. To compile, I tried the following: gcc -o foo foo.c libc.a This resulted in the...

View Article

gcc vs clang common library issue

I have two applications, one compiled with gcc(c++) and another compiled with clang++. I am to use common shared boost library for both the applications. My question is whether to compile boost shared...

View Article

how do I remove `GLIBC_2.27' requirement at compile time?

I've been using a docker image for c++ compilation. It's based on Ubuntu 18.04. When I attempt to run on some Ubuntu 16 systems, I get this message:/lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27'...

View Article


What is the difference between g++ and gcc?

What is the difference between g++ and gcc? Which one of them should be used for general c++ development?

View Article


Memory leak during unordered_map::insert KeyEqual exception with GCC -...

I'm using GCC 7.3.1, but also tested on coliru, which I believe is version 9.2.0. Build with the following:g++ -fsanitize=address -fno-omit-frame-pointer rai.cpp Here's rai.cpp:#include...

View Article

Can GCC ignore nonexisting directories?

I have two projects: mylib and myproj mylib compiles into a shared object. myproj uses mylib. I linking myproj using:g++ -L../../mylib/Release myproj.o -lmylib That works fine on my development...

View Article

Image may be NSFW.
Clik here to view.

C Program behaves differently if compiled using CLion rather than using gcc...

I'm writing a program to play 4 in a row using C90.I made a UI for the Console using ASCII characters.If I compile the program using C Lion I get the following output:If I compile it using gcc main.c...

View Article

Portable equivalent to gcc's __attribute__(cleanup)

Recently I came across a gcc extension that I have found rather useful: __attribute__(cleanup)Basically, this allows you to assign a cleanup call to a local variable at the time it exits scope. For...

View Article


Round double to nearest non subnormal representation

In C++ there are (sometimes) subnormal doubles that are finite, not nan and not zero.How can I round them to nearest non subnormal double representation?For example: std::isnormal(DBL_MIN/2.0) = false

View Article

How C preprocessor works?

How does the C Preprocessor handle multiple macros? I searched it over here and Google too but not able to understand the exact rule that should be followed. The following code:#define ABC xYz #define...

View Article


GCC 7, -Wimplicit-fallthrough warnings, and portable way to clear them?

We are catching warnings from GCC 7 for implicit fall through in a switch statement. Previously, we cleared them under Clang (that's the reason for the comment seen below):g++ -DNDEBUG -g2 -O3...

View Article

How can I compile a text file into a C++ program as a const string?

I have a C++ program which I'd like to have output a certain text file at some point. Of course I could have it open, read, and output the text file, but then I have to keep the binary and the text...

View Article


Recursive call in static function - gcc produces recursive_init_error exception

We have some code that has been recently ported to Linux (gcc 7.1 - glibc 2.17). I've included some snippets below - we use these macros in our class headers like shown below. This is all fine on...

View Article

Enable to compile sdl 1.2 project on macbook

I try this : g++ -Wall affichage.c -o game -D_REENTRANT -I/usr/local/Cellar/sdl/1.2.15_1/SDL but I have this error : Undefined symbols for architecture x86_64: "_SDL_EnableKeyRepeat", referenced from:...

View Article

C++ function`s declaration and definition are different but it works well

I'm writing some C++ code And I found a very strange thing Like below code, it works well even though a function's declaration and definition are different Does anyone know how can this is possible?...

View Article
Browsing all 22122 articles
Browse latest View live


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