Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: shiki on March 30, 2012, 10:02:55 am

Title: which macro is defined for line number in codeblock
Post by: shiki on March 30, 2012, 10:02:55 am
the line number is used to trace where the something happens. Is there any macro or function like that?
And how to get the current file name when program runs?
Title: Re: which macro is defined for line number in codeblock
Post by: oBFusCATed on March 30, 2012, 11:21:54 am
C/C++ macro or a macro in C::B's marco expansion rules?

(For the C/C++, you've asked at the wrong forum and the topic will be lock)
Here they are: __LINE__, __FUNCTION__, __FILE__

p.s. search the net is the faster option most of the time.
Title: Re: which macro is defined for line number in codeblock
Post by: shiki on March 30, 2012, 11:24:00 am
its should be OK now. When using GCC , these pre-defined macro are useful : __FILE__,__FUNCTION__,__LINE__
I misunderstood the compiler and the IDE . Under windows, when using vs, there is a little bit moment notice the compiler.
Title: Re: which macro is defined for line number in codeblock
Post by: shiki on March 30, 2012, 11:28:27 am
C/C++ macro or a macro in C::B's marco expansion rules?

(For the C/C++, you've asked at the wrong forum and the topic will be lock)
Here they are: __LINE__, __FUNCTION__, __FILE__

p.s. search the net is the faster option most of the time.

Thanks very much, This is what i need.