Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

#define LINE __LINE__

1 view
Skip to first unread message

ArbolOne

unread,
Oct 7, 2009, 8:03:35 PM10/7/09
to
Hello folks
I have a class that permeates in all and every class, it is a
MyException class kind of thing. The problem is that I have defined a
LINE variable like so"
#define LINE __LINE__
Now that I am trying to recompile my program in WindowsXP and using
the latest MS-Release of gtkmm, I get a message saying that I
stock.h's
extern GTKMM_API const Gtk::BuiltinStockID FILE; /*!<
@image html gtk-file.png */
expects more parameters.

Obviously the compiler thinks that I am reffering to the LINE defined
in stock.h and not the one defined in MyException.hpp.
Can someone give me an idea how to resolve this problem without having
to change my library.

Thanks

Ian Collins

unread,
Oct 8, 2009, 1:12:24 AM10/8/09
to
ArbolOne wrote:
> Hello folks
> I have a class that permeates in all and every class, it is a
> MyException class kind of thing. The problem is that I have defined a
> LINE variable like so"
> #define LINE __LINE__

That's not a variable.

Why can't you just use __LINE__, which is a reserved token which can't
be usurped in application code?

> Now that I am trying to recompile my program in WindowsXP and using
> the latest MS-Release of gtkmm, I get a message saying that I
> stock.h's
> extern GTKMM_API const Gtk::BuiltinStockID FILE; /*!<
> @image html gtk-file.png */
> expects more parameters.
>
> Obviously the compiler thinks that I am reffering to the LINE defined
> in stock.h and not the one defined in MyException.hpp.
> Can someone give me an idea how to resolve this problem without having
> to change my library.

Change your library!

--
Ian Collins

Anand Hariharan

unread,
Oct 8, 2009, 11:27:32 AM10/8/09
to
On Oct 8, 12:12 am, Ian Collins <ian-n...@hotmail.com> wrote:
> ArbolOne wrote:
> > Hello folks
> > I have a class that permeates in all and every class, it is a
> > MyException class kind of thing. The problem is that I have defined a
> > LINE variable like so"
> > #define  LINE      __LINE__
>
> That's not a variable.
>
> Why can't you just use __LINE__, which is a reserved token which can't
> be usurped in application code?
>

To the OP - Ian's right.

My question is what the preprocessor does here. Am fairly certain
that LINE is not a substitution for __LINE__ but rather the line
number in the header file where that directive was encountered -- is
that correct?

> > Now that I am trying to recompile my program in WindowsXP and using
> > the latest MS-Release of gtkmm, I get a message saying that I
> > stock.h's
> > extern GTKMM_API const Gtk::BuiltinStockID FILE;             /*!<
> > @image html gtk-file.png                */
> > expects more parameters.
>
> > Obviously the compiler thinks that I am reffering to the LINE defined
> > in stock.h and not the one defined in MyException.hpp.
> > Can someone give me an idea how to resolve this problem without having
> > to change my library.
>
> Change your library!
>

OP - Is your question about __LINE__ or __FILE__? If there can be
such a thing as "MORE WRONG", then substituting FILE for __FILE__ is
much worse than LINE for __LINE__ (which as Ian pointed out is wrong).

- Anand

0 new messages