Header files in different folder than source files

Header files in different folder than source files

61
Advanced UserAdvanced User
61

    Jul 29, 2005#1

    First of all, I'm blown away by UEStudio and what it can do! Thanks to IDM and all the developers for taking UltraEdit to the logical next step. :) I'll keep on using UltraEdit as well as UEStudio for many things, though, such as massaging data in log files, etc.

    Something I wish UEStudio would do (has been on my wish list ever since beta 2) is find my C/C++ header files (*.h) when they are in a different folder than the source (*.c or *.cpp files). IMHO this is the most common scenario when dealing with projects of any size (i.e. not toy projects).

    I can tell my compiler how to find the headers, but I can't seem to tell UEStudio how to find them, i.e. when I right-click on the file name in the #include line. If the header is in the same directory as the file which includes it, then it opens OK.

    If you have found out how to do this, please let me know. Otherwise, if you think that this should be fixed, by all means send IDM an e-mail at [email protected] and holler!

    Here's a tip for people using the MSVC++ Toolkit free command-line compiler with UEStudio. When you select the compiler, choose "Edit configuration". Look for a line in the [Settings] section like this:

    Code: Select all

    Additional Include Directories = 
    
    When you choose "Project->Settings->Compiler Options", you will be able to set one or more additional directories. However, there is no key in the [SettingsReps] to pick up the value you set here! Therefore, there is no effect on the command to compile your source.

    To remedy this, go to the [SettingsReps] section and add this line:

    Code: Select all

    Additional Include Directories = @/I%s
    
    Users of the Borland free command line compiler can use "-I" instead of "/I". Now you can use $(Additional Include Directories) as an additional switch in the compiler command.

    To do this, one final step is necessary: Go to the [Variables] section and look for this line:

    Code: Select all

    COPT = $(Compiler Options) $(Warning Level) <...snipped...>
    
    Insert "$(Additional Include Directories)" -- without the quotes -- right after "$(Compiler Options)".

    Now your compile command should include the /I switch along with any include directories you have set in the project settings compiler options.

      Aug 10, 2005#2

      I can now report a little progress on this front: :D

      All of your headers will be found by UEStudio (and ClassViewer and IntellTips) IF you add their path(s) to the "IncDirs" key under the [.EXT] section (actually it is called [.C] if you are compiling C or C++ code). HOWEVER, this DOES NOT YET WORK with RELATIVE paths! IDM and his crew are aware of this, since I have repeatedly e-mailed them about it, and they have been very quick to respond and they want to make this work with relative paths as well.

      Anyway, if you can live with absolute paths in the meantime, here's what you can do:

      Click on "Select Compiler" in the Build menu, then "Edit Configuration" in the dialog that opens (if it doesn't open already on its own -- it might be wise to make this a local project configuration by clicking on the "Make Configuration Local" button until you get it just the way you want for all your projects):

      If you are compiling in C or C++, hunt for a section called [.C] (it's red on my computer) ... In this section is a key/value pair called "IncDirs". Typically, this will look like:

      Code: Select all

      IncDirs = .;$(INCLUDE)
      IF you added the key/value line to [SettingsReps] for "Additional Include Directories" as per my previous post, change it to the following (otherwise, just add this line):

      Code: Select all

      Additional Include Directories = @%s
      (IOW, we are leaving out the compiler switch "/I" or "-I").

      Then go to the [Variables] section and change the COPTS value to look like this:

      Code: Select all

      COPT = $(Compiler Options) /I$(Additional Include Directories) $(Warning Level) (...etc. snipped)
      Note that I have added the "/I" switch to the variable and not directly to the "Additional Include Directories" key. Now change the "IncDirs" value to look like this:

      Code: Select all

      IncDirs = .;$(INCLUDE);$(Additional Include Directories)
      and click "Save Configuration".

      Now UEStudio should be able to navigate to your headers when you right-click on the #include line (even if they are in a different folder than the source!) To enable this, you can browse for any additional include directories in the "Compiler Settings" dialog accessible from the "Project->Project Settings" menu.

        Aug 12, 2005#3

        Switching from source to header via the toolbar button still doesn't work unless the header is found in the same folder as the source, BTW. But right-click on the #include "header.h" does work now.