Showing posts with label GCC. Show all posts
Showing posts with label GCC. Show all posts
Tuesday, April 9, 2013
unrecognized command line option “-std=c++11” with g++
http://stackoverflow.com/questions/14674597/cc1plus-error-unrecognized-command-line-option-std-c11-with-g
In versions pre-G++ 4.7, you'll have to use
http://stackoverflow.com/questions/11616539/g-nullptr-was-not-declared-in-this-scope
In versions pre-G++ 4.7, you'll have to use
-std=c++0x, for more recent versions you can use -std=c++11.http://stackoverflow.com/questions/11616539/g-nullptr-was-not-declared-in-this-scope
Wednesday, March 27, 2013
Define macro through command line
http://www.thegeekstuff.com/2012/05/c-macros/
$ gcc -Wall -DMACRO2 macro.c -o macro
Defining macros with values from command line
Not only the macros can be defined from command line (as shown in one of the sections above) but also they can be given values from command line. Lets take the following example :#include <stdio.h> int main(void) { #ifdef MACRO1 // test whether MACRO1 is defined... printf("\nMACRO1 Defined with value [%d]\n", MACRO1); #endif return 0; }In the code above, the macro MACRO1 is being tested and its value is being used but it is not defined anywhere. Lets define it from the command line :$ gcc -Wall -DMACRO1=25 macro.c -o macro $ ./macro MACRO1 Defined with value [25]
Wednesday, May 9, 2012
Can I use a binary literal in C or C++?
http://stackoverflow.com/questions/2611764/can-i-use-a-binary-literal-in-c-or-c
If you are using GCC then you can use GCC extension for this:
http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html
C operator precedence
http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence
If you are using GCC then you can use GCC extension for this:
int x = 0b00010000;http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html
Binary constants using the '0b' prefixhttp://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html
C operator precedence
http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence
Saturday, January 14, 2012
Subscribe to:
Posts (Atom)