# Include paths : which order?

**URL:** <https://community.freefem.org/t/include-paths-which-order/967>\
**Category:** General Discussion\
**Created:** [May 7, 2021, 10:49pm UTC](https://community.freefem.org/t/include-paths-which-order/967 "2021-05-07T22:49:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![david.fabre](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@david.fabre](https://community.freefem.org/u/david.fabre)\
**Post date:** [May 7, 2021, 10:49pm UTC](https://community.freefem.org/t/include-paths-which-order/967/1 "2021-05-07T22:49:13Z")

</div>

Hello all !

One question about how paths are handled in “include” statements.

My freefem++.pref file contains this :  
includepath += “./”  
includepath += “/Users/fabred/StabFem\_DEVELOP/StabFem/SOURCES\_FREEFEM/INCLUDE/”

And my programs contain this:  
include “SF\_AutoInclude.idp”

The file “SF\_Autoinclude.idp” may be either in the current path “./” or in the directory “/Users/fabred/StabFem\_DEVELOP/StabFem/SOURCES\_FREEFEM/INCLUDE/” . I want to use the one in the current directory if present or a default one in the other directory if not. This does not work, and freefem wants to use the default one in all case.

Can someone indicate me a rule that forces to look for include files in the current directory in priority ?

Thanks  
David

---

<div class="post-metadata">

**Author:** ![759022](https://avatars.discourse-cdn.com/v4/letter/7/8e8cbc/32.png) [@759022](https://community.freefem.org/u/759022)\
**Post date:** [October 28, 2024, 2:02pm UTC](https://community.freefem.org/t/include-paths-which-order/967/2 "2024-10-28T14:02:03Z")

</div>

When I was trying to reproduce your work, I encountered the following difficulties：  
9 : include “SF\_AutoInclude.idp” Error opening file SF\_AutoInclude.idp in:  
– try :“SF\_AutoInclude.idp”  
– try :“D:\Program Files (x86)\FreeFem++\idp\SF\_AutoInclude.idp”

Error line number 9, in file StabFem.idp, before token SF\_AutoInclude.idp  
lex: Error input opening file  
current line = 9  
Compile error : lex: Error input opening file  
line number :9, SF\_AutoInclude.idp  
error Compile error : lex: Error input opening file  
line number :9, SF\_AutoInclude.idp  
code = 1 mpirank: 0  
try getConsole C:\Users\Owner\Desktop\free\_fem\O-S equation\Newton\_2D.edp  
I don’t have the SF\_AutoInclude.idp source code .If you had, could you share with me. If you solve the problem without this software, could I know how you can fix it?  
We look forward to hearing from you and thank you in advance for your help.
