Results 1 to 3 of 3
Hello,
I'm working on a project that is supposed to compile on multiple UNIX and Linux systems. I develop on Fedora 13, but the program should compile on older versions, ...
- 01-24-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 2
G++ Compiler problem
Hello,
I'm working on a project that is supposed to compile on multiple UNIX and Linux systems. I develop on Fedora 13, but the program should compile on older versions, RHEL (as far back as Enterprise 2), etc.
The problem is that on Fedora 13 my g++ compiler is somewhat lax in enforcing rules. For example, my latest problem was that I had a class which had an indexer where index was an unsigned int. Mistakenly, I had used int in a part of the program. Compiler on Fedora 13 compiled that without even a warning, but the one on RHEL 5 didn't compile. Earlier I also had problems with missing return statements which I had forgotten to write (and similarly, compiler on Fedora 13 didn't even warn me about it).
My question is whether I can set up my Fedora 13 compiler to report such errors (as well as treat warnings as errors)?
EDIT: If I can, how do I do that?
Thanks,
Nikola
- 01-24-2011 #2Just Joined!
- Join Date
- Dec 2009
- Location
- Maryland, USA
- Posts
- 83
I suggest you start here and continue to other pages, if necessary.
- 01-25-2011 #3Just Joined!
- Join Date
- Jan 2011
- Posts
- 2
Thanks.
My first guess is to use -pedantic or -pedantic-errors, however:
So should I instead use a combination of -W*s and -Werror?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.
Is there any way to set up the compiler to use these as default (without having to type them every time I compile/write the makefile)?
Nikola


Reply With Quote