__FILE__ macro

G

Guest

VC7.1 changes the __FILE__.

In vc6, the __FILE__ returns the [full path name of the file]. However, in
vc7.1, the __FILE__ just returns the [.\file name]. It looks like vc7.1
changes a lot of things which makes it quite difficult to migrate vc6 code to
vc7.1. I am a little bit disappointed by vc7.1.

Any way, is there exited any macro to get the full path name during the
compilation?

thanks in advance,
lauch2
 
D

David Lowndes

VC7.1 changes the __FILE__.
In vc6, the __FILE__ returns the [full path name of the file]. However, in
vc7.1, the __FILE__ just returns the [.\file name].

Strange, it shows the full path for me.

Do you have a way to reproduce this?

Dave
 
G

Guest

Do you have a way to reproduce this?
int _tmain(int argc, _TCHAR* argv[])
{
puts(__FILE__);
return 0;
}

FYI:
In Debug build, it returns the full path name
In Release build, it returns .\filename

Regards,
lauch2
David Lowndes said:
VC7.1 changes the __FILE__.

In vc6, the __FILE__ returns the [full path name of the file]. However, in
vc7.1, the __FILE__ just returns the [.\file name].

Strange, it shows the full path for me.

Do you have a way to reproduce this?

Dave
 
D

David Lowndes

In Debug build, it returns the full path name
In Release build, it returns .\filename

So it does!

Set the /FC compiler switch:

"Without /FC, the diagnostic text would look similar to this
diagnostic text:

compiler_option_FC.cpp(5) : error C2143: syntax error : missing ';'
before '}'

With /FC, the diagnostic text would look similar to this diagnostic
text:

c:\test\compiler_option_FC.cpp(5) : error C2143: syntax error :
missing ';' before '}'

/FC is also needed if you want to see the full path of a file name
when using the __FILE__ macro. See Predefined Macros for more
information on __FILE__.
"

Dave
 

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

Top