Essayes également de rajouter des arguments comme gcc -Wall -pedantic pour avoir plus d'information sur les erreurs.
Je fais plutôt gcc -W -Wall [-std=XXX [-pedantic]]. Le -W est à remplacer par -Wextra en GCC 4; -std=XXX pour spécifier la version de C, et -pedantic sert à ajouter des warnings demandés par la norme C et à d'autres choses (c'est moi qui souligne):
-pedantic
Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some other programs that do not follow ISO C and ISO C++. For ISO C, follows the version of the ISO C standard specified by any -std option used.
Valid ISO C and ISO C++ programs should compile properly with or without this option (though a rare few will require -ansi or a -std option specifying the required version of ISO C). However, without this option, certain GNU extensions and traditional C and C++ features are supported as well. With this option, they are rejected.
-pedantic does not cause warning messages for use of the alternate keywords whose names begin and end with `__'. Pedantic warnings are also disabled in the expression that follows __extension__. However, only system header files should use these escape routes; application programs should avoid them. See Alternate Keywords.
Some users try to use -pedantic to check programs for strict ISO C conformance. They soon find that it does not do quite what they want: it finds some non-ISO practices, but not all—only those for which ISO C requires a diagnostic, and some others for which diagnostics have been added.
[ source:http://gcc.gnu.org/onlinedocs/gcc-4.0.2/gcc/Warning-Options.(...) ]
Donc -pedantic rejettera les programmes utilisant des extensions au C "pur ISO", dont POSIX, par exemple, ou peut-être les IPC... (j'ai pas vérifié pour les IPC, mais je me suis déjà fait jeter par -pedantic pour du POSIX)
Et, au passage, je n'utilise -pedantic qu'avec -std=XXX, pour bien savoir quelle version/extension de C j'utilise (et aussi au cas où quelqu'un pase derrière et ne connaît pas la version C par défaut de gcc, ou s'il utilise un autre compilateur, ou quand gcc changera de version C par défaut...).
[^] # Re: #include <sem.h>
Posté par alf . En réponse au message les sémaphores nommés. Évalué à 2.
[ source:http://gcc.gnu.org/onlinedocs/gcc-4.0.2/gcc/Warning-Options.(...) ]
Donc -pedantic rejettera les programmes utilisant des extensions au C "pur ISO", dont POSIX, par exemple, ou peut-être les IPC... (j'ai pas vérifié pour les IPC, mais je me suis déjà fait jeter par -pedantic pour du POSIX)
Et, au passage, je n'utilise -pedantic qu'avec -std=XXX, pour bien savoir quelle version/extension de C j'utilise (et aussi au cas où quelqu'un pase derrière et ne connaît pas la version C par défaut de gcc, ou s'il utilise un autre compilateur, ou quand gcc changera de version C par défaut...).