All Questions

354
votes
10answers
135190 views

Why does the order in which libraries are linked sometimes cause errors in GCC?

Why does the order in which libraries are linked sometimes cause errors in GCC?
140
votes
13answers
203921 views

Removing 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)) { ...
81
votes
3answers
19712 views

Is gcc 4.8 or earlier buggy about regular expressions?

I am trying to use std::regex in a C++11 piece of code, but it appears that the support is a bit buggy. An example: #include <regex> #include <iostream> int main (int argc, const char * ...
103
votes
7answers
96953 views

Multiple glibc libraries on a single host

Multiple glibc libraries on a single host My linux (SLES-8) server currently has glibc-2.2.5-235, but I have a program which won't work on this version and requires glibc-2.3.3. Is it possible to ha...
461
votes
27answers
254007 views

How to automatically generate a stacktrace when my gcc C++ program crashes

When my C++ program crashes I would like it to automatically generate a stacktrace. My program is being run by many different users and it also runs on Linux, Windows and Macintosh (all versions are ...
139
votes
8answers
40012 views

Why does flowing off the end of a non-void function without returning a value not produce a compiler error?

Ever since I realized many years ago, that this doesn't produce an error by default, (in gcc at least) I've always wondered why? I understand that you can issue compiler flags to produce a warning, b...
36
votes
13answers
41066 views

Why is scanf() causing infinite loop in this code?

I've a small C-program which just reads numbers from stdin, one at each loop cycle. If the user inputs some NaN, an error should be printed to the console and the input prompt should return again. On ...
33
votes
3answers
4580 views

How to remove "noise" from GCC/clang assembly output?

I want to inspect the assembly output of applying boost::variant in my code in order to see which intermediate calls are optimized away. When I compile the following example (with GCC 5.3 using g++ -...
14
votes
10answers
13053 views

Scanf skips every other while loop in C

I'm trying to develop a simple text-based hangman game, and the main game loop starts with a prompt to enter a guess at each letter, then goes on to check if the letter is in the word and takes a life...
625
votes
10answers
312320 views

What is the difference between g++ and gcc?

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

Previous Next