Problem with <includepath>

Peter Kern
  • Peter Kern
    Peter Kern

    Hello all,

    I am using the following construtct in my build file:

    <includepath >
      <fileset dir="${dir.include.gxyi}" includes="*.h*" excludes="ConfigFileMng.h">

    I want to exclude one header file from all the other header files. It seems that this solution does not work, because I am getting the following error:

    "Command line is over maximum length without specifying source file"

    Does anybody know a better solution for excluding a specific header file?

    Thanks in advance.

    • Curt Arnold
      Curt Arnold

      The includepath element is intended to specify additional DIRECTORIES that are used to resolve #include statements that appear in the source file.  For example,

      <includepath dir="somelib/include"/>

      would result in a


      being added to the command line.  Includepath allows nested filesets since it inherits from Ant's Path class, but use of fileset's nested in includepath's is unusual.  I assume what is happening is that each file in the fileset results in an additional  -I directive which drives the command over the command line limit.

      cpptasks is limited by the capabilities of the command line compilers that it drives.   I don't know of any way to specify for any common compiler that some include directory should be used to match all include requests except for a specific one.  Those situations are generally addressed by include path order, not exclusion.   You would typically do is place the location of the preferred version earlier in the include path.

      So you would place the preferred "ConfigFileMng.h" in its own directory and then do:

      <include path="preferred/include"/>
      <include path="${dir.include.gxyi}"/>

      If you want files that include ConfigFileMng.h to fail to compile, you might need to copy "${dir.include.gxyi}" excluding ConfigFileMng.h to some place in your build directory and then specify that directory in your include path.

      • Peter Kern
        Peter Kern

        Hello Curt,

        thank you for your answer.
        Placing the files to exclude in a sparate directory is not possible, because I get the source files from pvcs an the structure is given.
        Copying the needed header files to new directory is good hin. I will try to rename the excluded header files. Perhaps this works too.