微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

MacOS:无法使用 icpc intel 编译器进行编译:灾难性错误:无法打开源文件“time.h”?

如何解决MacOS:无法使用 icpc intel 编译器进行编译:灾难性错误:无法打开源文件“time.h”?

我正在尝试在 Big Sur 11.2 上的 C++ 代码上使用编译器 intel icpc 编译器。不幸的是,我在编译时遇到以下错误

icpc -std=c++11 -O3 -xHost  -Wall -c -I/Opt/intel/compilers_and_libraries_2020.4.301/mac/mkl/include -I/Opt/intel/compilers_and_libraries_2020/mac/include -qopenmp -mkl=parallel main_intel.cpp -o main_intel.o
In file included from /Library/Developer/CommandLinetools/usr/include/c++/v1/chrono(797),from XSAF_C_intel.h(2),from main_intel.cpp(7):
/Library/Developer/CommandLinetools/usr/include/c++/v1/ctime(49): catastrophic error: cannot open source file "time.h"
  #include <time.h>

对于编译,我输入:

$ make intel

与制作:

ifneq ($(MAKECMDGOALS),clean)
 include $(MAKECMDGOALS).make
endif

OBJECTS = $(SOURCES:.cpp=.o)

$(MAKECMDGOALS): clean $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
    $(CXX) $(LDFLAGS) $(OBJECTS) -o $@

.cpp.o:
    $(CXX) $(CXXFLAGS) $< -o $@

.PHONY: clean

clean:
    rm -f *.o $(EXECUTABLE)

和 intel.make :

CXX = icpc -std=c++11 -O3 -xHost
CXXFLAGS = -Wall -c -I${MKLROOT}/include -I/Opt/intel/compilers_and_libraries_2020/mac/include -qopenmp -mkl=parallel
LDFLAGS = -L/Library/Developer/CommandLinetools/SDKs/MacOSX.sdk/usr/lib -lSystem -L$MKLROOT/lib -Wl,-rpath,$MKLROOT/lib -Wl,$MKLROOT/../compiler/lib -qopenmp -mkl
SOURCES = main_intel.cpp XSAF_C_intel.cpp
EXECUTABLE = main_intel.exe

谁能看出哪里出了问题?

命令行工具

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。