makuto / cakelisp

Metaprogrammable, hot-reloadable, no-GC language for high perf programs (especially games), with seamless C/C++ interop
https://macoy.me/blog/programming/CakelispIntro
Other
338 stars 16 forks source link

Following tutorial, g++ cant find hpp files #9

Closed retrogradeorbit closed 2 years ago

retrogradeorbit commented 2 years ago

Following the tutorial on linux, got to the first macro invocation. then this:

./Dependencies/cakelisp/bin/cakelisp src/MyProject.cake && ./a.out foo
cakelisp_cache/CakelispComptime.hpp:1:10: fatal error: Evaluator.hpp: No such file or directory
 #include "Evaluator.hpp"
          ^~~~~~~~~~~~~~~
compilation terminated.
g++ -g -x c++-header cakelisp_cache/CakelispComptime.hpp -o cakelisp_cache/CakelispComptime.hpp.gch -Isrc/ -fPIC 
Failed to update precompiled header cakelisp_cache/CakelispComptime.hpp.gch
Failed with 1 errors.

Evaluator.hpp is there: ./Dependencies/cakelisp/src/Evaluator.hpp but it cant find it.

Advice?

makuto commented 2 years ago

Hi,

This happens because compile-time code execution needs the Cakelisp headers to know Cakelisp's compile-time API.

To fix this, you need to specify where Cakelisp's source code is:

(set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src")

This is set up this way so people can decide to have a local install (e.g. Cakelisp in their project's directories, which is what I recommend) or a system install.

If you want to build on Windows, you also want to add this line, which tells the compile-time linker where Cakelisp's executable  .lib file is:

(set-cakelisp-option cakelisp-lib-dir "Dependencies/cakelisp/bin")

Which tutorial were you following? I can update it to clarify this.

I just made a change, 4be183e, that will report a helpful error that looks like this:

runtime/Cakelisp.cake:4:1: error: Cannot build compile-time macros, generators, or functions because cakelisp-src-dir is not set. Set it with e.g.:     (set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src")