How to read errors?

D

desktop

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(typename
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?
 
R

Roland Pibinger

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.
 
G

Guest

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.
 
C

Charles

... 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.
 
B

Barry

desktop said:
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(typename
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top