Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Add a path by name to visual studio additional xxx directories

pascal_M_
Beginner
1,008 Views

I have added `C:\path\to\files\thelibrary\include` to the `Configuration Properties --> Fortran --> General --> Additional Include Directories`, and used an `#include <someheaderfile.h>` inside my code, and everything was compiling as intended. Now I have created a sytem environment variable `TOTO` with value `C:\path\to\files\thelibrary` and replaced `C:\path\to\files\thelibrary\include` with `%TOTO%\include` inside `Configuration Properties --> Fortran --> General --> Additional Include Directories` and at compilation I had an `#error: can't find include file: someheaderfile.h`. I also tried with `%(TOTO)\include` and `%TOTO%\include` as well as `TOTO\include` and had the same error. I don't know though if this error is specific to the fact that I am inside a intel visual fortran project for visual studio or if I would have had the same issue with a vanilla c++ visual studio project.

Of course, I have the same issue with "additional libraries" etc.

0 Kudos
7 Replies
Lorri_M_Intel
Employee
1,008 Views

After you defined the system environment variable, did you exit/restart your Visual Studio window?  Not just reload the Fortran solution, actually exit out and restart Visual Studio.

And, no, this isn't just a Fortran-integration thing.   I've seen this sort of thing with pure C/C++ projects too.

                  --Lorri

0 Kudos
pascal_M_
Beginner
1,008 Views

Lorri Menard (Intel) wrote:

After you defined the system environment variable, did you exit/restart your Visual Studio window?  Not just reload the Fortran solution, actually exit out and restart Visual Studio.

And, no, this isn't just a Fortran-integration thing.   I've seen this sort of thing with pure C/C++ projects too.

                  --Lorri

I even rebooted the d*** computer. :) One precision though : the problem does happen with the (system) environment variable I have created, but doesn't with using the environment variable IFORT_COMPILER19 in `%IFORT_COMPILER19%mkl\lib\intel64_win` for instance.

0 Kudos
pascal_M_
Beginner
1,008 Views

Other precision : I confirm that this doesn't happen with a vanilla (c++ console for instance) visual studio 2017 project, nor with intel visual fortran console project. (My project type, with which I have a problem, is "intel visual fortran dll project".)

0 Kudos
Steve_Lionel
Honored Contributor III
1,008 Views

The syntax you want is $(TOTO)

0 Kudos
pascal_M_
Beginner
1,008 Views

As I wrote in my question, I "did" try $(TOTO) and it didn't work ... Anyway, now it worked. (Strange, maybe I mixed up things.)

Question, though : why does %TOTO% work for a fortran console project but not for a fortran dll project ?

 

0 Kudos
Steve_Lionel
Honored Contributor III
1,008 Views

I would not expect %TOTO% to work in either. Certainly the project type doesn't matter. The %TOTO% syntax works in a shell command,but not in the list of additional include directories.

What I have seen sometimes is that setting system environment variables don't "take" right away, sometimes needing a logout/login.

0 Kudos
pascal_M_
Beginner
1,008 Views

Steve Lionel (Ret.) (Blackbelt) wrote:

I would not expect %TOTO% to work in either. Certainly the project type doesn't matter. The %TOTO% syntax works in a shell command,but not in the list of additional include directories.

Well `%IFORT_COMPILER19%mkl\include` is understood without problem any though.

Steve Lionel (Ret.) (Blackbelt) wrote:

What I have seen sometimes is that setting system environment variables don't "take" right away, sometimes needing a logout/login.

Yes, same for me, I was never clear on that.

0 Kudos
Reply