Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
37 Views

Add a path by name to visual studio additional xxx directories

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
Highlighted
37 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
Highlighted
Beginner
37 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
Highlighted
Beginner
37 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
Highlighted
Black Belt Retired Employee
37 Views

The syntax you want is $(TOTO)

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
37 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
Highlighted
Black Belt Retired Employee
37 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.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
37 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