Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VS 7. EnvDTE - VCCodeInclude Help

Status
Not open for further replies.

Stevoie

Programmer
Jun 7, 2001
68
IE
Hi

I'm using the Visual Studio 7 EnvDTE API to gather information about my C++ source code, in particular, any includes that appear in my source files but I cannot find out which file (with path) that the include statement points to.

For example:
file editor.cpp has
Code:
 include <text.h>
I need to know the absolute path to this text.h file. i think i could even get by with the relative path.

From what i can see of the API i can only get the path of the source file editor.cpp that the include statement appears in.

Any help would be great.

Stevoie
 
I thought you could highlight an #include statement like that and right-click and go to the actual file, or something like that. Also, if you search your whole computer for that file and you have more than one by that name, check under tools->options to see which include paths you have. if more than one path is in the list that contains a file by that name, the one on top has highest priority. To make sure that you get the right one, you could add additional include folder in your Project->Settings dialog, once you know the full path, use that, or goto Project->Add existing item and add the file to your actual project

bdiamond
 
thanks for the suggestion.
i'm using the EnvDTE API to get the full include path and then searching it to check if the header file appears anywhere on the path. it works.

for anyone thats interested heres a VB script to get the include paths of a VS C++ project:

Code:
    Sub Test()
        Dim prj As VCProject
        Dim cfgs As IVCCollection
        Dim tools As IVCCollection
        Dim cfg As VCConfiguration
        Dim tool As VCCLCompilerTool
        Dim ret As String
        prj = DTE.Solution.Projects.Item(1).Object
        cfgs = prj.Configurations
        cfg = cfgs.Item(1)
        tool = cfg.Tools("VCCLCompilerTool")
        MsgBox(tool.FullIncludePath())
    End Sub

Stevoie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top