Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
__FILE__ macro
Jump...
Cancel
Locked
Locked
Replies
4 replies
Subscribers
119 subscribers
Views
3513 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
How was your experience today?
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
__FILE__ macro
Steven Logan
over 12 years ago
Note: This was originally posted on 8th May 2013 at
http://forums.arm.com
When using the __FILE__ macro in RVDS4, it only expands to "source/file.cpp". It won't ever expand to more than just the directory the file is in.
It seems everyone has problems shortening the path from __FILE__ rather than getting it to show more.
Is there anyway to resolve this?
Loggie
Steven Logan
over 12 years ago
Note: This was originally posted on 9th May 2013 at
http://forums.arm.com
You are right in that __FILE__ is what is given on the command line. At least for me this is the case. I would be able to achieve what I require by using a longer path as it currently stands I only require the name of the folder the source directory is in, each of these folders are respective of their separate project. i.e. project_name/source/file.cpp. However trying to adjust the supplied paths to give me what I need could potentially cause a whole load of other problems.
Currently I am trying to define a macro called FILE_NAME using -DFILE_NAME="project_name/source/file.cpp" however I get no end of errors, mostly telling me that FILE_NAME is undefined.
Cancel
Vote up
0
Vote down
Cancel
Steven Logan
over 12 years ago
Note: This was originally posted on 10th May 2013 at
http://forums.arm.com
[size=2]Thanks Scott, however [/size]I have been speaking with a colleague and we have come to the conclusion that since each filename is unique, we can solve the problem with the following. By specifying the root path of the entire solution we can search the project folders and build a hash table with filename key's that correspond to the full path to the file.. This would allow us to obtain the functionality we desire without requiring any changes to our actual code.
Cancel
Vote up
0
Vote down
Cancel
Scott Douglass
over 12 years ago
Note: This was originally posted on 8th May 2013 at
http://forums.arm.com
I would expect that __FILE__ was the same as the file name given on the command line. (Or for #included files, the path constructed from the parent directory of a file on the command line and/or the -I directives.).
Can you get what you want by specifying longer paths on the command line?
Cancel
Vote up
0
Vote down
Cancel
Scott Douglass
over 12 years ago
Note: This was originally posted on 9th May 2013 at
http://forums.arm.com
You may be having quoting problems. On a Linux host try -DFILE_NAME=\""..."\" on a Windows host try -DFILE_NAME=""""..."""" [I _wish_ I was kidding]
Cancel
Vote up
0
Vote down
Cancel