# Compiling Xfoil

**URL:** <https://fortran-lang.discourse.group/t/compiling-xfoil/10848>\
**Category:** LFortran\
**Created:** [April 10, 2026, 10:07am UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848 "2026-04-10T10:07:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![oroppas](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/oroppas/32/6937_2.png) [@oroppas](https://fortran-lang.discourse.group/u/oroppas)\
**Post date:** [April 10, 2026, 10:07am UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/1 "2026-04-10T10:07:37Z")

</div>

Compiling Xfoil [https://web.mit.edu/drela/Public/web/xfoil/](https://web.mit.edu/drela/Public/web/xfoil/) failed with the following message:

```auto
lfortran -c -O -fbounds-check --fixed-form ../src/xfoil.f
tokenizer error: Expecting terminating symbol for program
  --> ../src/xfoil.f:25:7
   |
25 | INCLUDE 'XFOIL.INC'
   | ^

Note: Please report unclear, confusing or incorrect messages as bugs at
https://github.com/lfortran/lfortran/issues.
make: *** [Makefile:164: xfoil.o] Error 1

```

Am I missing something?

```auto
lfortran --version
LFortran version: 0.61.0
Status: alpha (expected to fail on third-party codes)
Platform: Linux
LLVM: 19.1.1
Default target: x86_64-conda-linux-gnu
LSP Version: 3.17.0
JSON_RPC Version: 2.0

```

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [April 10, 2026, 11:25am UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/2 "2026-04-10T11:25:56Z")

</div>

Welcome to the Forum!

You should note that lfortran is still very much under development and it may be that the old construct “INCLUDE” is not supported. You may have better luck by either using a different compiler like gfortran or ifx, which do support the FORTRAN 77 style construct you have encountered or turning the include file into a module.

---

<div class="post-metadata">

**Author:** ![kkifonidis](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kkifonidis](https://fortran-lang.discourse.group/u/kkifonidis)\
**Post date:** [April 10, 2026, 12:35pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/3 "2026-04-10T12:35:02Z")

</div>

I think @Arjen already gave you the most probable reason why ‘INCLUDE’ doesn’t seem to work (LFortran’s support of some older features is not yet on the same level of maturity as that of the more recent Fortran features).

You may wish to try substituting `INCLUDE 'XFOIL.INC'` by `#include "XFOIL.INC"`, though, since LFortran does support C-style preprocessing with the `--cpp` compiler flag.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [April 10, 2026, 4:51pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/4 "2026-04-10T16:51:38Z")

</div>

@oroppas thanks for the bug report, I was able to reproduce it and I just fixed it in [Fix INCLUDE statement handling in fixed-form Fortran by certik · Pull Request #11035 · lfortran/lfortran · GitHub](https://github.com/lfortran/lfortran/pull/11035).

We support `include`, but didn’t support it in fixed-form, which I now fixed.

We now support all Fortran features (except coarrays and length PDT), but they can still have bugs like the one you encountered. Modern Fortran in free-form works pretty well, some old F77 features might not be implemented yet (if so, please report it), also the fixed-form parser sometimes has bugs, but if you report them (ideally as a standalone minimal reproducible example), then we’ll fix them quickly. Regarding compiling third-party codes, right now our status is expressed in the version information you printed above (`Status: alpha (expected to fail on third-party codes)`). So expected to fail, but it might not be difficult to fix all bugs to get it working, depending on the code. If you are interested, please report all bugs and we’ll fix them all.

---

<div class="post-metadata">

**Author:** ![RonShepard](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@RonShepard](https://fortran-lang.discourse.group/u/RonShepard)\
**Post date:** [April 10, 2026, 6:58pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/5 "2026-04-10T18:58:13Z")

</div>

> [@Arjen](#):
>
> You should note that lfortran is still very much under development and it may be that the old construct “INCLUDE” is not supported.

Some of these comments are a little confusing. `INCLUDE` was **not** an f77 feature. It was an extension of many f77 compilers, but it was not a standard feature. INCLUDE was part of f90, and remains standard even now with f2023 (in section 6.4).

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [April 10, 2026, 8:02pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/6 "2026-04-10T20:02:06Z")

</div>

> [@RonShepard](#):
>
> `INCLUDE` was **not** an f77 feature. It was an extension of many f77 compilers, but it was not a standard feature. INCLUDE was part of f90, and remains standard even now with f2023 (in section 6.4).

Yes. That’s why we only supported it in free-form, because F77 codes in fixed-form wouldn’t use it as much, but clearly they do. Anyway, it’s fixed in the latest LFortran main.

---

<div class="post-metadata">

**Author:** ![oroppas](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/oroppas/32/6937_2.png) [@oroppas](https://fortran-lang.discourse.group/u/oroppas)\
**Post date:** [April 12, 2026, 11:14am UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/7 "2026-04-12T11:14:15Z")

</div>

Hi @certik ,

Thank you for the quick fix! I see some other bugs so I’ll report them with the minimal reproducible examples.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [April 12, 2026, 2:52pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/8 "2026-04-12T14:52:40Z")

</div>

Yes, please do! Thank you @oroppas. We’ll fix them quickly.

---

<div class="post-metadata">

**Author:** ![wspector](https://avatars.discourse-cdn.com/v4/letter/w/47e85d/32.png) [@wspector](https://fortran-lang.discourse.group/u/wspector)\
**Post date:** [April 12, 2026, 5:59pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/9 "2026-04-12T17:59:18Z")

</div>

> [@certik](#):
>
> That’s why we only supported it in free-form, because F77 codes in fixed-form wouldn’t use it as much, but clearly they do.

I would suspect just the opposite - that INCLUDE is used far more in older codes than more modern ones where modules are used.

Although not in the Fortran Standard until Fortran-90, INCLUDE has been around in one form or another long before that. Sometimes via pre-processing tools, and sometimes built into the compiler. It was also part of the DOD MIL-SPEC 1753 standard, published in 1978.

---

<div class="post-metadata">

**Author:** ![rwmsu](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@rwmsu](https://fortran-lang.discourse.group/u/rwmsu)\
**Post date:** [April 12, 2026, 6:06pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/10 "2026-04-12T18:06:27Z")

</div>

> [@wspector](#):
>
> I would suspect just the opposite - that INCLUDE is used far more in older codes than more modern ones where modules are used.

Thats my experience. Back in the days when COMMON blocks were the only way to share data globally, it was standard practice in just about every code I used from around 1983 on to place COMMON block definitions in INCLUDE files. That was about the only way in a very large code you could make sure that the COMMON blocks were defined consistently in every routine that used them.

---

<div class="post-metadata">

**Author:** ![RonShepard](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@RonShepard](https://fortran-lang.discourse.group/u/RonShepard)\
**Post date:** [April 12, 2026, 8:59pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/11 "2026-04-12T20:59:59Z")

</div>

> [@wspector](#):
>
> would suspect just the opposite - that INCLUDE is used far more in older codes than more modern ones where modules are used.

I had always avoided using INCLUDE in f77 codes because I knew some compilers did not support it, and I wanted my codes to be as portable as possbile. I first saw INCLUDE used in fortran codes in the late 1970s. That would have been about the same time as the MIL-SPEC-1753 document, or maybe just a year or so before. So now I’m curious, which fortran compilers supported INCLUDE before that? How about the DEC compilers in the late 60s or early 70s? Anyone know?

As for how it was used at that time, there were several situations:

1. It was a way to localize the IMPLICIT statements. Often there was a single ‘implicit.inc’ file that was included in the first line of each subroutine. This made it easier to change a whole program from REAL to DOUBLE PRECISION. With this convention, arrays were declared with DIMENSION statements and not with REAL, INTEGER, etc. statements, their types were determined implicitly from their first letter. Some compilers had default 16-bit integers, so this was a way to easily use 32-bit integers instead.

2. As already mentioned, it was a way to make common blocks uniform across a whole program. You could make a single change to a common block in the ‘common.inc’ file, recompile, and everything was consistent. Well, mostly. You still had the issue of a common block variable clashing with a local variable.

3. For commonly used statement functions. Some compilers treated statement functions as in-line macros, so they were faster than using compiled external functions. But you needed a way to make them consistent across a whole program, so INCLUDE files could do that. The problem was to avoid multiple definitions of the various arguments.

4. If your program had shared parameters, e.g. integers used as array dimensions or real values of PI, speed of light C, and so on, then INCLUDE was a way to put them all in one place.

5. Common subprogram code for multiple types. If a REAL function, a DOUBLE PRECISION function, and a COMPLEX function all had the same statements, and differed only in the declarations of the variables, then INCLUDE could be used to simplify the code maintenance for that family of functions.

I would say that MODULEs in f90 mostly obviated the first four uses of INCLUDE, The last one was still used even with modules after f90. In fact, INCLUDE might have been used even more after f90 when generic subprogram interfaces were introduced and when multiple REAL, INTEGER, and LOGICAL kinds were standardized.

---

<div class="post-metadata">

**Author:** ![wspector](https://avatars.discourse-cdn.com/v4/letter/w/47e85d/32.png) [@wspector](https://fortran-lang.discourse.group/u/wspector)\
**Post date:** [April 13, 2026, 12:54am UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/12 "2026-04-13T00:54:22Z")

</div>

> [@RonShepard](#):
>
> I would say that MODULEs in f90 mostly obviated the first four uses of INCLUDE, The last one was still used even with modules after f90. In fact, INCLUDE might have been used even more after f90 when generic subprogram interfaces were introduced and when multiple REAL, INTEGER, and LOGICAL kinds were standardized.

Nowadays for #5, I generally just use the `fypp` pre-processor. I keep going back and forth as to whether it is better to use macros (`#:def`), or loops (`#:for`) to replicate code.

---

<div class="post-metadata">

**Author:** ![RonShepard](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@RonShepard](https://fortran-lang.discourse.group/u/RonShepard)\
**Post date:** [April 13, 2026, 2:17am UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/13 "2026-04-13T02:17:38Z")

</div>

In the early 2000s, I used the filepp preprocessor for that same purpose. It was written in perl, so it was portable and it gave the same behavior everywhere, unlike many of the fortran built-in preprocessors at that time. It started off as just a portable cpp replacement, but then some other features, such as loops and regular expression substitutions, were added. I experimented a little with writing library codes that supported multiple kinds using those features, but it was complicated.

> **[Filepp : The generic file preprocessor](https://www-users.york.ac.uk/~dm26/filepp/)**

---

<div class="post-metadata">

**Author:** ![oroppas](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/oroppas/32/6937_2.png) [@oroppas](https://fortran-lang.discourse.group/u/oroppas)\
**Post date:** [July 19, 2026, 6:35am UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/14 "2026-07-19T06:35:59Z")

</div>

Hi @certik,

With LFortran 0.64.0, I’ve got the tokenizer error

```auto
 lfortran -c -O -fdefault-real-8 --fixed-form ../src/xfoil.f
tokenizer error: Token '$' is not recognized in `format` statement
 --> ../src/xfoil.f:1:1
  |
1 | C ***********************************************************************
  | ^

```

I think I was able to create a minimal reproducer and filed the issue:

[tokenizer error: Token '$' is not recognized in `format` statement · Issue #12284 · lfortran/lfortran · GitHub](https://github.com/lfortran/lfortran/issues/12284)

---

<div class="post-metadata">

**Author:** ![jwmwalrus](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jwmwalrus/32/4483_2.png) [@jwmwalrus](https://fortran-lang.discourse.group/u/jwmwalrus)\
**Post date:** [July 19, 2026, 8:08am UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/15 "2026-07-19T08:08:49Z")

</div>

IIRC, that’s an extension. The [ifort’s documentation](https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2023-0/dollar-sign-and-backslash-editing.html#GUID-62AD904C-6AE8-4BAF-8FAA-2B9E2E123B12) seems to confirm it (i.e., text for extensions has a different color than standard features).

Btw, the effect of the extension seems to be the same as `ADVANCE='NO'`.

---

<div class="post-metadata">

**Author:** ![wspector](https://avatars.discourse-cdn.com/v4/letter/w/47e85d/32.png) [@wspector](https://fortran-lang.discourse.group/u/wspector)\
**Post date:** [July 19, 2026, 4:05pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/16 "2026-07-19T16:05:18Z")

</div>

Yes, it is yet another ancient DEC extension, going all the way back to the DEC-10 and PDP-11.

---

<div class="post-metadata">

**Author:** ![RonShepard](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@RonShepard](https://fortran-lang.discourse.group/u/RonShepard)\
**Post date:** [July 19, 2026, 4:55pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/17 "2026-07-19T16:55:21Z")

</div>

> [@jwmwalrus](#):
>
> Btw, the effect of the extension seems to be the same as `ADVANCE='NO'`.

In this situation, perhaps the code should be fixed rather than adding the extension to a compiler.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [July 19, 2026, 7:59pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/18 "2026-07-19T19:59:13Z")

</div>

It’s been fixed. Looks like both Flang and GFortran support it, so LFortran now too. We should probably give a warning that this is an extension.

---

<div class="post-metadata">

**Author:** ![oroppas](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/oroppas/32/6937_2.png) [@oroppas](https://fortran-lang.discourse.group/u/oroppas)\
**Post date:** [July 20, 2026, 8:36am UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/19 "2026-07-20T08:36:49Z")

</div>

Hi @certik,

LFortran version: 0.64.0-20-gace400cfb

```auto
lfortran -c -O -fdefault-real-8 --fixed-form ../src/xfoil.f
semantic error: Expecting a scalar integer or parameter annotated integer variable
  --> ../src/xfoil.f:35:18
   |
35 | DATA ANGTOL / 40.0 /

```

It appears LFortran is unable to handle `DATA`

```auto
      PROGRAM FOO

      DATA ANGTOL / 40.0 /

      END

```

```auto
lfortran -c -O -fdefault-real-8 --fixed-form foo.f
semantic error: Variable 'angtol' is not declared
 --> foo.f:3:12
  |
3 | DATA ANGTOL / 40.0 /
  | ^^^^^^ 'angtol' is undeclared

```

Both `gfortran` and `flang` are able to handle it. I filed the issue [semantic error: Variable 'angtol' is not declared · Issue #12295 · lfortran/lfortran · GitHub](https://github.com/lfortran/lfortran/issues/12295)

Thank you.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [July 20, 2026, 3:45pm UTC](https://fortran-lang.discourse.group/t/compiling-xfoil/10848/20 "2026-07-20T15:45:00Z")

</div>

@oroppas LFortran can handle data. The issue is that LFortran by default doesn’t allow implicit typing, you have to explicitly enable it with `--implicit-typing`, then it works.

[Next page](https://fortran-lang.discourse.group/t/compiling-xfoil/10848.md?page=2)
