c - Using -Wall -Wextra in GCC and getting Errors -


i not sure why receiving these errors, when compile gcc , not use -wall , -wextra program compiles fine. however, when use flags -wall , -wextra receive compile errors.

here test program ran:

#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h>  int main(void) {     return 0; } 

... , here errors that:

/home/definity/desktop/cloud/code/funcptr: in function `_fini': (.fini+0x0): multiple definition of `_fini' /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o:(.fini+0x0): first defined here /home/definity/desktop/cloud/code/funcptr: in function `data_start': (.data+0x0): multiple definition of `__data_start' /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o:(.data+0x0): first defined here /home/definity/desktop/cloud/code/funcptr: in function `data_start': (.data+0x8): multiple definition of `__dso_handle' /usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o:(.data+0x0): first defined here /home/definity/desktop/cloud/code/funcptr:(.rodata+0x0): multiple definition of `_io_stdin_used' /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o:(.rodata.cst4+0x0): first defined here /home/definity/desktop/cloud/code/funcptr: in function `_start': (.text+0x0): multiple definition of `_start' /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o:(.text+0x0): first defined here /home/definity/desktop/cloud/code/funcptr: in function `main': /home/definity/desktop/cloud/code/funcptr.c:35: multiple definition of `main' /tmp/ccthunuj.o:/home/definity/desktop/cloud/code/funcptr.c:9: first defined here /home/definity/desktop/cloud/code/funcptr: in function `_init': (.init+0x0): multiple definition of `_init' /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o:(.init+0x0): first defined here /usr/lib/gcc/x86_64-linux-gnu/4.7/crtend.o:(.tm_clone_table+0x0): multiple definition of `__tmc_end__' /home/definity/desktop/cloud/code/funcptr:(.data+0x10): first defined here /usr/bin/ld: error in /home/definity/desktop/cloud/code/funcptr(.eh_frame); no .eh_frame_hdr table created. collect2: error: ld returned 1 exit status [finished in 0.1s exit code 1] 

... not able interpret these errors. can explain why these errors occurring , can prevent happening in future?

based on this link :

    -wall             enables warnings constructions users consider  questionable, , easy avoid (or modify prevent warning), in  conjunction macros. enables language-specific warnings described in c++ dialect options , objective-c , objective-c++ dialect options.              -wall turns on following warning flags:                        -waddress                          -warray-bounds (only -o2)                         -wc++11-compat                         -wchar-subscripts                         -wenum-compare (in c/objc; on default in c++)                        -wimplicit-int (c , objective-c only)                        -wimplicit-function-declaration (c , objective-c only)                        -wcomment                         -wformat                          -wmain (only c/objc , unless -ffreestanding)                         -wmaybe-uninitialized                        -wmissing-braces (only c/objc)                        -wnonnull                         -wparentheses                         -...              note warning flags not implied -wall. of them warn          constructions users not consider questionable, might wish check for; others warn constructions necessary or hard     avoid in cases, , there no simple way modify code suppress warning.      of them enabled -wextra many of them must enabled individually.  

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -