compiler option Testing $ls unsigned.c $gcc unsigned.c $./a.out The Geek Stuff [-10] $gcc -funsigned-char unsigned.c $./a.out The Geek Stuff [246] $cat unsigned.c #include<stdio.h> int main(void) { char c = -10; // Print the string printf(“n The Geek Stuff [%d]n”, c); return 0; } $
Daily Archives: February 13, 2013
GCC COMMANDLINE OPTIONS PART 8 -ansi
commandline session $cat main.c #include<stdio.h> #include<math.h> int main(void) { int i=0; float y; printf(“n The Geek Stuff [%d]n”, i); y=sinf(2.5); printf(“%fn”,y); return 0; } $gcc -ansi main.c /tmp/ccBNR3rx.o: In function `main’: main.c:(.text+0x3c): undefined reference to `sinf’ collect2: error: ld returned 1 exit status $gcc main.c $
GCC COMMANDLINE OPTIONS PART 7
commandline session $gcc -v main.c Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v –with-pkgversion=’Debian 4.7.2-4′ –with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs –enable-languages=c,c++,go,fortran,objc,obj-c++ –prefix=/usr –program-suffix=-4.7 –enable-shared –enable-linker-build-id –with-system-zlib –libexecdir=/usr/lib –without-included-gettext –enable-threads=posix –with-gxx-include-dir=/usr/include/c++/4.7 –libdir=/usr/lib –enable-nls –with-sysroot=/ –enable-clocale=gnu –enable-libstdcxx-debug –enable-libstdcxx-time=yes –enable-gnu-unique-object –enable-plugin –enable-objc-gc –with-arch-32=i586 –with-tune=generic –enable-checking=release –build=x86_64-linux-gnu –host=x86_64-linux-gnu –target=x86_64-linux-gnu Thread model: posix gcc version 4.7.2 (Debian 4.7.2-4) COLLECT_GCC_OPTIONS=’-v’ ‘-mtune=generic’ ‘-march=x86-64’ …
GCC COMMANDLINE OPTIONS PART 6
commandline session $ gcc -c -Wall -Werror -fPIC main.c main.c: In function ‘main’: main.c:8:10: error: ‘i’ is used uninitialized in this function [-Werror=uninitialized] cc1: all warnings being treated as errors $vim main.c $cat main.c #include<stdio.h> #include<math.h> int main(void) { float y; printf(“n The Geek Stuff [%d]n”, i); y=sinf(2.5); printf(“%fn”,y); return 0; } $ gcc -c …