AlgorithmicBotany / vlab

Virtual Laboratory
GNU General Public License v3.0
37 stars 6 forks source link

Lpfg limits syntax error #3

Open macadamia opened 4 months ago

macadamia commented 4 months ago

including env.hpp (Kipp Horel's code for the shadow model) in Ubuntu 20.04 results in

Error: syntax error in /usr/include/c++/9/limits line 1668. Current token static.

I've attached a simple case showing this.

limitsTest.zip

It seems to be occurring at the preproc.sh stage.

mikcieslak commented 4 months ago

I tried the simple test case on Ubuntu 20.04.3 LTS (via WSL) and got the same error. The cause is the #include <algorithm> in env.hpp. If you move the includes from env.hpp to the lsystem.l file and put them before #include <lpfgall.h>, the error should be resolved. I think there may be a conflict between the standard library header <limits> and lpfgall.h. I always try to include all headers before lpfgall.h unless there is some thing I need from it, e.g., V3f, in another header file.

I also ran the simple test case on Ubuntu 22.04.3 LTS (via WSL) and did not get an error. Consequently, the problem may be related to the version of gcc (9.4.0 vs 11.3.0). Alternatively, you could switch to using the shadowpyramid environmental program, and, possibly, avoid these types of issues in the future---but I get it may be more convenient to use the LightModel class directly.