g++ a [[Libre]] [[C++]] [[Compiler]]

g++ -std=c++98 -fno-gnu-keywords -ffor-scope -Wall -pedantic -W  \
   *Wold-style-cast -Woverloaded-virtual -Wsign-promo -Wundef \
   *Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Winline \
   *Wdisabled-optimization -O2



Control warnings

#pragma warning(disable: 985) // identifier truncated in debug

tells version, macro etc

# gcc -v -E -march=i686 - # on SunOS
Reading specs from  /usr/local/gcc-2.8.1/lib/gcc-lib/sparc-sun-solaris2.7/2.8.1/specs
gcc version 2.8.1
/usr/local/gcc-2.8.1/lib/gcc-lib/sparc-sun-solaris2.7/2.8.1/cpp -lang-c -v
*undef -D**GNUC**=2 -D__GNUC_MINOR__=8
*Dsparc -Dsun -Dunix -D**svr4** -D**SVR4 -D**sparc** -D**sun__
*D**unix** -D**svr4** -D**SVR4 -D**sparc -D**sun -D**unix
*Asystem(unix) -Asystem(svr4) -D__GCC_NEW_VARARGS__
*Acpu(sparc) -Amachine(sparc) -
GNU CPP version 2.8.1 (sparc)
#include "..." search starts here:
#include <...> search starts here:
End of search list.

about the only common versioning you get is the :

**STDC** def
__cplusplus is the equivalent for C++

With an optimized compiler, I specifically used:

  • O3 -pipe -fomit-frame-pointer -funroll-loops
  • march=pentium3 -mcpu=pentium3 -mfpmath=sse -mmmx -msse

GCC Warnings

snprintf :

 too many arguments for format
 unknown conversion type character 'l' in format

$FILE.h:71: warning: '$CLASS' has a field '$CLASS::$MEMBER' whose type uses the anonymous namespace

GCC errors

incompatible types in assignment
cannot convert to a pointer type

Make sure you're passing address with '&'

sorry, unimplemented: inlining failed in call to '': function body not available


g++ error:

 "error: too few template-parameter-lists"
  error: expected ')' before '__PRETTY_FUNCTION__'

@tag: preprocessor

"fatal error: asm/errno.h: No such file or directory"

sudo aptitude install g++-4.6-multilib
sudo ln -fs asm-generic /usr/include/asm
#error "Requires IEEE 754 floating point!" 

error: 'constexpr' needed for in-class initialization of static data member

error: reinterpret_cast from integer to pointer

g++ warning:

 warning: dereferencing type-punned pointer will break strict-aliasing rules


"error: invalid use of incomplete type "
"error: forward declaration of"

"undefined reference to `typeinfo for "




gcc.txt · Last modified: 2017/10/04 23:49 by rzr
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki