Hello guys.
I used to know how to check the compiler warnings but I completely forgot how to.
Can someone please enlighten me ?
Thanks,
Dean.
Hello guys.
I used to know how to check the compiler warnings but I completely forgot how to.
Can someone please enlighten me ?
Thanks,
Dean.
click 2 times onto warnings messages below your code in build log, it goes the line which gives you warning.
Didn't understand what you are trying to say rac1, sorry.
Your question in post one is not very clear. Do you need help to insure your compiler is generating warnings? Or do you need help figuring out some specific error message? You will either need to say how you are compiling your code, what compiler, operating system, IDE you are using. Or post the warning message and the code that generated the message, then ask specific questions on the code, messages provided.
Jim
I don't know of a single compiler that would make it difficult to find warnings.
But if you really had no idea where to start, and you had already looked for them yourself, already searched the help files for your compiler, and already searched google.... why would you post your question in a board specific to C programming?
If you are using the console to compile your code you need to add switches to generate warnings. I usually compile with the following compiler flags:
The last line is what I usually consider the minimum warnings. The -g includes debug information to be able to run the the program with the debugger.-Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline -Wunreachable-code
-Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default
-Wshadow -Wmain -pedantic-errors -pedantic -Wextra -Wall -ansi -g -std=c99
Jim
Found out how to.
When compiling I usually do gcc -w -o "name of the function" "name of the function .c"
In this case I just had to do gcc -w "name of the function" "name of the function .c"
I got this though :
Strange warningsCode:alocamemoria: In function `_start': (.text+0x0): multiple definition of `_start' /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o:(.text+0x0): first defined here alocamemoria: In function `_fini': (.fini+0x0): multiple definition of `_fini' /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crti.o:(.fini+0x0): first defined here alocamemoria:(.rodata+0x0): multiple definition of `_IO_stdin_used' /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o:(.rodata.cst4+0x0): first defined here alocamemoria: In function `__data_start': (.data+0x0): multiple definition of `__data_start' /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o:(.data+0x0): first defined here alocamemoria: In function `__data_start': (.data+0x8): multiple definition of `__dso_handle' /usr/lib/gcc/x86_64-linux-gnu/4.4.5/crtbegin.o:(.data+0x0): first defined here alocamemoria: In function `_init': (.init+0x0): multiple definition of `_init' /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crti.o:(.init+0x0): first defined here /tmp/ccG51wV7.o: In function `ver': alocamemoria.c:(.text+0x0): multiple definition of `ver' alocamemoria:(.text+0xe4): first defined here /tmp/ccG51wV7.o: In function `main': alocamemoria.c:(.text+0x17c): multiple definition of `main' alocamemoria:(.text+0x260): first defined here /usr/lib/gcc/x86_64-linux-gnu/4.4.5/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__' alocamemoria:(.dtors+0x8): first defined here /usr/bin/ld: warning: Cannot create .eh_frame_hdr section, --eh-frame-hdr ignored. /usr/bin/ld: error in alocamemoria(.eh_frame); no .eh_frame_hdr table will be created. collect2: ld returned 1 exit status
How should I be using those compiler flags ?
Never had to use 'em so I have no idea on how to.
Sorry, Jim.
Once again thanks, Dean.
From Option Summary - Using the GNU Compiler Collection (GCC)
Get rid of "-w"-w
Inhibit all warning messages.
Tim S.
The -w turns off all warnings, this is definitely not what you want.
Jim
Hum, thanks all!
I took off -w and compiled it just using -o and it worked perfectly. Gave me just what I was looking for.
Thanks ya'll D: