Make sure to follow all the steps
- Set the
JULIA_DIR
environment variable. That should be the folder that containsbin
,include
, andlib
. - The
bin
folder under JULIA_DIR should be on the system PATH. - To modify the project, I used this main function and needed to add two additional preprocessor directives.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <julia.h>
int main()
{
jl_init();
jl_eval_string("print(sqrt(2.0))");
jl_atexit_hook(0);
return 0;
}
- Set the project to Debug x64
- Using the project Properties dialog, go to
C/C++
|General
and add$(JULIA_DIR)\include\julia\
to the Additional Include Directories property - Then, go to the
Linker
|General
section and add$(JULIA_DIR)\lib
to the Additional Library Directories property. - Finally, under
Linker
|Input
, addlibjulia.dll.a;libopenlibm.dll.a;
to the list of libraries
I then get the following build log:
Build started...
1>------ Build started: Project: JuliaDemoEmbedding, Configuration: Debug x64 ------
1>JuliaDemoEmbedding.cpp
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\signal.h(26,1): warning C4005: 'NSIG': macro redefinition
1>~\.julia\juliaup\julia-1.7.3+0~x64\include\julia\uv\win.h(75): message : see previous definition of 'NSIG'
1>JuliaDemoEmbedding.vcxproj -> ~\source\repos\JuliaDemoEmbedding\x64\Debug\JuliaDemoEmbedding.exe
1>Done building project "JuliaDemoEmbedding.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========