Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > How to read errors?

Reply
Thread Tools

How to read errors?

 
 
desktop
Guest
Posts: n/a
 
      09-29-2007
Each time I compile my program I get something like this:

g++ -trigraphs -o draw main.cpp -lGL -lGLU -lglut -lX11 -lm -I../src
In file included from solution/print.h:6,
from solution/rasterizer.h:10,
from main.cpp:26:
solution/rasterizer.h:328:7: warning: no newline at end of file
In file included from main.cpp:26:
solution/rasterizer.h:328:7: warning: no newline at end of file
In file included from main.cpp:30:
solution/fragment_program.h:38:7: warning: no newline at end of file
solution/rasterizer.h: In member function ‘void
graphics::MyRasterizer<math_types>::init(const typename
math_types::vector3_type&, const typename math_types::vector3_type&,
const typename math_types::vector3_type&, const typename
math_types::vector3_type&, const typename math_types::vector3_type&,
const typename math_types::vector3_type&, const typename
math_types::vector3_type&, const typename math_types::vector3_type&,
const typename math_types::vector3_type&)’:
solution/rasterizer.h:145: error: expected `)' before ‘{’ token
solution/rasterizer.h: In member function ‘void
graphics::MyRasterizer<math_types>::init(const typename
math_types::vector3_type&, const typename math_types::vector3_type&,
const typename math_types::vector3_type&, const typename
math_types::vector3_type&, const typename math_types::vector3_type&,
const typename math_types::vector3_type&, const typename
math_types::vector3_type&, const typename math_types::vector3_type&,
const typename math_types::vector3_type&) [with math_types =
graphics::MyMathTypes]’:
main.cpp:200: instantiated from here
solution/rasterizer.h:136: warning: converting to ‘int’ from ‘float’
solution/rasterizer.h:137: warning: converting to ‘int’ from ‘float’
solution/rasterizer.h:138: warning: converting to ‘int’ from ‘float’
main.cpp:200: instantiated from here
solution/rasterizer.h:140: warning: converting to ‘int’ from ‘float’
solution/rasterizer.h: In member function ‘Line
graphics::MyRasterizer<math_types>::createLine(typ ename
math_types::vector3_type, typename math_types::vector3_type,
std::string) [with math_types = graphics::MyMathTypes]’:
solution/rasterizer.h:115: instantiated from ‘void
graphics::MyRasterizer<math_types>::init(const typename
math_types::vector3_type&, const typename math_types::vector3_type&,
const typename math_types::vector3_type&, const typename
math_types::vector3_type&, const typename math_types::vector3_type&,
const typename math_types::vector3_type&, const typename
math_types::vector3_type&, const typename math_types::vector3_type&,
const typename math_types::vector3_type&) [with math_types =
graphics::MyMathTypes]’
main.cpp:200: instantiated from here
solution/rasterizer.h:171: warning: converting to ‘int’ from ‘float’
solution/rasterizer.h:172: warning: converting to ‘int’ from ‘float’
solution/rasterizer.h:173: warning: converting to ‘int’ from ‘float’
solution/rasterizer.h:174: warning: converting to ‘int’ from ‘float’
make: *** [main] Error 1

In this case I got an error because of a missing matching parenthesis.
But each time I use a rather large amount of time finding the above
errormessage.

Is there someway to compile with the option that only errormessages will
be shown?
 
Reply With Quote
 
 
 
 
Roland Pibinger
Guest
Posts: n/a
 
      09-29-2007
On Sat, 29 Sep 2007 19:40:22 +0200, desktop <(E-Mail Removed)> wrote:
>Each time I compile my program I get something like this:


[~50 lines snipped]

>In this case I got an error because of a missing matching parenthesis.
>But each time I use a rather large amount of time finding the above
>errormessage.
>
>Is there someway to compile with the option that only errormessages will
>be shown?


Avoid templates (templated libraries) and the error messages will
become civilized again.


--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch
 
Reply With Quote
 
 
 
 
yanlinlin82@gmail.com
Guest
Posts: n/a
 
      09-29-2007
use -w option.

 
Reply With Quote
 
=?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=
Guest
Posts: n/a
 
      09-29-2007
On 2007-09-29 20:06, Roland Pibinger wrote:
> On Sat, 29 Sep 2007 19:40:22 +0200, desktop <(E-Mail Removed)> wrote:
>>Each time I compile my program I get something like this:

>
> [~50 lines snipped]
>
>>In this case I got an error because of a missing matching parenthesis.
>>But each time I use a rather large amount of time finding the above
>>errormessage.
>>
>>Is there someway to compile with the option that only errormessages will
>>be shown?

>
> Avoid templates (templated libraries) and the error messages will
> become civilized again.


Or (if running Windows) use VC++ 8 or better, it produces much better
error messages for templates. Though it still can spew out lots of lines
at least it is a lot more readable than what g++ will give you.

Another tips to the OP, if you get many error messages just fix the
first and compile again. Often most of the error messages are because
the compiler never really "recovered" from the first error.

--
Erik Wikström
 
Reply With Quote
 
desktop
Guest
Posts: n/a
 
      09-29-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> use -w option.
>


Thanks, that helped even though it did not completely eliminate all the
template garbage when an error is made.
 
Reply With Quote
 
Charles
Guest
Posts: n/a
 
      09-30-2007
> ... if you get many error messages just fix the
> first and compile again.


That is excellent advice. Also Item 49 in Scott Meyers' wonderful book
"Effective STL" is "Learn to decipher STL-related compiler diagnostics." It
helped me immensely.

--
Chuck


 
Reply With Quote
 
Barry
Guest
Posts: n/a
 
      09-30-2007
desktop wrote:
> Each time I compile my program I get something like this:
>
> g++ -trigraphs -o draw main.cpp -lGL -lGLU -lglut -lX11 -lm -I../src
> In file included from solution/print.h:6,
> from solution/rasterizer.h:10,
> from main.cpp:26:
> solution/rasterizer.h:328:7: warning: no newline at end of file
> In file included from main.cpp:26:
> solution/rasterizer.h:328:7: warning: no newline at end of file
> In file included from main.cpp:30:
> solution/fragment_program.h:38:7: warning: no newline at end of file
> solution/rasterizer.h: In member function ‘void
> graphics::MyRasterizer<math_types>::init(const typename
> math_types::vector3_type&, const typename math_types::vector3_type&,
> const typename math_types::vector3_type&, const typename
> math_types::vector3_type&, const typename math_types::vector3_type&,
> const typename math_types::vector3_type&, const typename
> math_types::vector3_type&, const typename math_types::vector3_type&,
> const typename math_types::vector3_type&)’:
> solution/rasterizer.h:145: error: expected `)' before ‘{’ token
> solution/rasterizer.h: In member function ‘void
> graphics::MyRasterizer<math_types>::init(const typename
> math_types::vector3_type&, const typename math_types::vector3_type&,
> const typename math_types::vector3_type&, const typename
> math_types::vector3_type&, const typename math_types::vector3_type&,
> const typename math_types::vector3_type&, const typename
> math_types::vector3_type&, const typename math_types::vector3_type&,
> const typename math_types::vector3_type&) [with math_types =
> graphics::MyMathTypes]’:
> main.cpp:200: instantiated from here
> solution/rasterizer.h:136: warning: converting to ‘int’ from ‘float’
> solution/rasterizer.h:137: warning: converting to ‘int’ from ‘float’
> solution/rasterizer.h:138: warning: converting to ‘int’ from ‘float’
> main.cpp:200: instantiated from here
> solution/rasterizer.h:140: warning: converting to ‘int’ from ‘float’
> solution/rasterizer.h: In member function ‘Line
> graphics::MyRasterizer<math_types>::createLine(typ ename
> math_types::vector3_type, typename math_types::vector3_type,
> std::string) [with math_types = graphics::MyMathTypes]’:
> solution/rasterizer.h:115: instantiated from ‘void
> graphics::MyRasterizer<math_types>::init(const typename
> math_types::vector3_type&, const typename math_types::vector3_type&,
> const typename math_types::vector3_type&, const typename
> math_types::vector3_type&, const typename math_types::vector3_type&,
> const typename math_types::vector3_type&, const typename
> math_types::vector3_type&, const typename math_types::vector3_type&,
> const typename math_types::vector3_type&) [with math_types =
> graphics::MyMathTypes]’
> main.cpp:200: instantiated from here
> solution/rasterizer.h:171: warning: converting to ‘int’ from ‘float’
> solution/rasterizer.h:172: warning: converting to ‘int’ from ‘float’
> solution/rasterizer.h:173: warning: converting to ‘int’ from ‘float’
> solution/rasterizer.h:174: warning: converting to ‘int’ from ‘float’
> make: *** [main] Error 1
>
> In this case I got an error because of a missing matching parenthesis.
> But each time I use a rather large amount of time finding the above
> errormessage.
>
> Is there someway to compile with the option that only errormessages will
> be shown?


uncomment the lines that likely to produce compile time error,
then you can locate the exact place where you write the code wrong.

so don't wait to compile until you write a lot of new complicated code.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Help: Program to read from EOR end of last read? snoopy_@excite.com Java 3 04-07-2006 12:32 PM
Binary data stored in SQL Server: can't read from ASP.NET, *can* read from Access? Doug ASP .Net 3 11-04-2005 07:35 PM
Re: Unable to read video DVDs and can read Data DVDs Biz DVD Video 0 07-22-2005 03:44 AM
Re: How to change Read Only Constraint to Read-Write Isaac VHDL 0 07-10-2003 01:43 PM



Advertisments