Gcc Stop On Error
Contents |
to make GCC stop on first gnu make stop on first error error From: Francesco Montorsi dot it> To: gcc at gcc dot gnu dot org Date: Wed, 28 Mar 2007 15:41:37 +0200 Subject: How to make GCC stop on first error Hi all, I wonder if there is some option/flag I can feed to gcc to avoid that it continues compiling my source files after it encounters the first error... I've searched in gcc docs without success. makefile ignore error and continue This is very annoying when e.g. the first error is due to not finding a required header file: after that gcc goes on and spits out tons of errors about missing declarations for those things which are declared in the not-found header file. btw stopping on the first error is the default behaviour of many other compilers (e.g. M$, borland, watcom compilers on win32)... Thanks, Francesco Follow-Ups: Re: How to make GCC stop on first error From: Manuel López-Ibáñez Re: How to make GCC stop on first error From: Tom Tromey Index Nav: [DateIndex] [SubjectIndex] [AuthorIndex] [ThreadIndex] Message Nav: [DatePrev][DateNext] [ThreadPrev][ThreadNext] here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business gcc options Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation g++ -wfatal-errors Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up gcc compiler not stop on first error up vote 5 down vote favorite 1 How does one get gcc to not stop compiling after https://gcc.gnu.org/ml/gcc/2007-03/msg01089.html the first error. Is there a compiler flag that will do this? Basically I'm wanting to remove a class, but i'm not sure how much of an impact that will have, so i'm wanting to determine how many classes would have provblems if i, say, remove the class from the makefile. Is there a better way to determine this impact? gcc compiler-construction compiler-errors compiler-flags share|improve this question asked Nov 21 '12 at 16:08 shadonar 3621625 http://stackoverflow.com/questions/13497307/gcc-compiler-not-stop-on-first-error add a comment| 2 Answers 2 active oldest votes up vote 15 down vote accepted There's a GCC compiler option -Wfatal-errors to stop after the first error: -Wfatal-errors This option causes the compiler to abort compilation on the first error occurred rather than trying to keep going and printing further error messages You can also use -Werror if you want to treat warnings as errors so that you'll catch any warning that might be generated when you remove your class. share|improve this answer answered Nov 21 '12 at 16:29 P.P. 58.3k768119 add a comment| up vote 1 down vote Is there a better way to determine this impact? Use the refactoring support, built-in in many IDEs. For example, with NetBeans, you can choose to rename a class and preview all affected places. Without an IDE, you can rename the class/method/field, instead of deleting it and gradually, with several compilation runs, change all usages of the old name, where the compiler gives an error. Then grep for the new name. share|improve this answer answered Nov 21 '12 at 16:46 chill 12k11834 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting …and How-to Solve The Problem1.1 Compilation Errors1.1.1 Error: …discards qualifiers1.1.2 Error: storage size of ‘foo' isn't known1.1.3 Error: multiple types in one declaration1.1.4 Error: invalid use of undefined type ‘struct Foo’1.1.5 Error: no matching function http://digitalfanatics.org/resources/gcc-error-messages/ for call to ‘FooClass::foo()'1.1.6 Error: undefined reference to ‘FooClass::foo()'1.1.7 Error: invalid operands of http://www.mosaic-industries.com/embedded-systems/sbc-single-board-computers/freescale-hcs12-9s12-c-language/instrument-control/compiler-error-messages types `const char[31]' and `const char[7]' to binary `operator+'1.1.8 Error: `QValueList' undeclared (first use this function)1.1.9 Error: cannot call member function `Foo* Foo::instance() const' without object1.1.10 Errors: non-pointer type, non-aggregate type, cannot convert1.1.11 Error: syntax error before `*' token1.1.12 Error: `foo' is not a type1.1.13 Error: unable to find a register to stop on spill in class `FOO'1.1.14 Error: invalid operands to binary ‘operator<<‘1.2 Qt Peculiarities1.2.1 Using Qt - invalid use of void expression1.2.2 Using Qt - …before ‘protected’1.2.3 Using Qt - …vtable1.3 Serious Warnings1.3.1 Warning: Control reaches the end of a non-void function1.3.2 Warning: ‘foo’ is used uninitialized in this function1.3.3 Warning: cannot pass objects of non-POD type ‘struct std::string' through ‘…' This page has been converted from a stop on error Wiki formatted article. If I've missed anything in the conversion process, please tell. Sometimes GCC emits something that can be described as Haiku poems - and you have no clue as to what it really is complaining about. This page is a collection of such gems, their meaning in English and how to solve the problem. If you run into an error that you feel belongs here, feel free to mail me. I'm using GMail as e8johan. Compilation Errors This is a list of compilation errors that you might find yourself trying to interpret in no particular order. Error: …discards qualifiers Error message: passing ‘const ClassName’ as ‘this’ argument of ‘virtual void ClassName::methodName()’ discards qualifiers. You have called a method that isn't const using a const object (const ClassName *foo). Either add const to you method, e.g. class ClassNameGcc Continue On Error
Makefile Stop On First Error
Make Stop On Error
{
public:
void methodName() const;
}; Alternatively, you remove the const from your object, declaring it as ClassName *foo instead of const ClassName *foo. Sometimes it is possible to solve this issue using const_cast (thanks Witold). Refer to this DevX article for an example of this. Error: storage size of ‘foo' isn't known Error mes