How to read errors?

Discussion in 'C++' started by desktop, Sep 29, 2007.

  1. desktop

    desktop Guest

    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?
    desktop, Sep 29, 2007
    #1
    1. Advertising

  2. On Sat, 29 Sep 2007 19:40:22 +0200, desktop <> 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
    Roland Pibinger, Sep 29, 2007
    #2
    1. Advertising

  3. desktop

    Guest

    use -w option.
    , Sep 29, 2007
    #3
  4. On 2007-09-29 20:06, Roland Pibinger wrote:
    > On Sat, 29 Sep 2007 19:40:22 +0200, desktop <> 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
    =?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=, Sep 29, 2007
    #4
  5. desktop

    desktop Guest

    wrote:
    > use -w option.
    >


    Thanks, that helped even though it did not completely eliminate all the
    template garbage when an error is made.
    desktop, Sep 29, 2007
    #5
  6. desktop

    Charles Guest

    > ... 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
    Charles, Sep 30, 2007
    #6
  7. desktop

    Barry Guest

    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(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.
    Barry, Sep 30, 2007
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    922
    Mark Goldin
    Jan 17, 2004
  2. SenthilVel
    Replies:
    0
    Views:
    930
    SenthilVel
    Jun 7, 2006
  3. George1776

    Out-of-memory errors and caching errors.

    George1776, Aug 28, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    1,262
    George1776
    Sep 14, 2006
  4. Lance Wynn
    Replies:
    1
    Views:
    1,811
    Lance Wynn
    Feb 3, 2008
  5. yawnmoth
    Replies:
    97
    Views:
    4,642
    Bent C Dalager
    Feb 27, 2009
Loading...

Share This Page