使用C编程嵌入Julia时出现问题,求助

我在用clion写C程序的时候想用到Julia,就参照着documentation在CMakeLists.txt里加了两行,然后再在程序里include。但是build的时候弹出了错误信息,不知道要怎么弄,求大神指教,谢谢。
用的编译器是MinGW w64 6.0
Julia版本是1.0

CMakeLists里添加的代码是:

set(INC_DIR C:/Julia/lang/Julia-1.0.0/include/julia)
include_directories(${INC_DIR})

报错提示如下:

Scanning dependencies of target ClionProjects
[ 11%] Building C object CMakeFiles/ClionProjects.dir/greenhand/draft.obj
In file included from C:/Julia/lang/Julia-1.0.0/include/julia/julia.h:67,
from D:\Onedrive\Study\Code\C\ClionProjects\greenhand\draft.c:2:
C:/Julia/lang/Julia-1.0.0/include/julia/atomics.h:9:4: error: #error Julia can only be built for architectures above Pentium 4. Pass -march=pentium4, or set MARCH=pentium4 and ensure that -march is not passed separately with an older architecture.
error Julia can only be built for architectures above Pentium 4. Pass -march=pentium4, or set MARCH=pentium4 and ensure that -march is not passed separately with an older architecture.
^~~~~
mingw32-make.exe[3]: *** [CMakeFiles\ClionProjects.dir\build.make:161: CMakeFiles/ClionProjects.dir/greenhand/draft.obj] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:72: CMakeFiles/ClionProjects.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:84: CMakeFiles/ClionProjects.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: ClionProjects] Error 2

报错好像是说你差 set MARCH 的编译设置选项,加上试试。而且,你的电脑是不是有点太老了?

我的CPU是酷睿8代,就是不知道为什么会出现说architecture太老。C的编译器我也不是很懂,在Google查了set MARCH好像找不到信息,可以麻烦具体说一下需要在clion或者cmakelists里怎么修改吗?

在编译选项里面加上 -march=pentium4 试试,比如:
gcc a.cpp -march=pentium4
而且,这个也有可能是 MinGW 的问题。

#if defined(__i386__) && defined(__GNUC__) && !defined(__SSE2__)
#  error Julia can only be built for architectures above Pentium 4. Pass -march=pentium4, or set MARCH=pentium4 and ensure that -march is not passed separately with an older architecture.

这个看起来不是Julia的问题,应该是你的机器确实不行… 定义了 __i386__ 但是没有 SSE2 指令。你可能需要确定一下你的机器是否支持SSE2,然后看看是不是mingw的问题,Windows上面不妨用MSVC试试,可能会好点。