Tôi đang cố gắng thiết lập dự án OpenMP bằng cách sử dụng clang (3.7.0) trên máy tính xách tay chạy Linux của mình.'omp.h' khi biên dịch bằng cách sử dụng clang
Bây giờ tôi đã đọc rằng OpenMP không được hỗ trợ ngay lập tức vì vậy tôi đã làm theo hướng dẫn này https://clang-omp.github.io/ để tích hợp OpenMP vào tiếng kêu.
Tôi đã sao chép mã nguồn, đặt biến môi trường và đặt cờ -fopenmp cho dự án của tôi, nhưng tôi vẫn gặp lỗi "lỗi nghiêm trọng: 'omp.h' không tìm thấy" khi xây dựng.
Tôi đoán là tôi đã đặt biến môi trường sai. Có cách nào để kiểm tra xem tôi có đặt đúng vị trí không? Tôi vừa sao chép chúng trong tệp .bashrc.
Edit: khi tôi chạy $ xác định vị trí omp.h tôi nhận được:
/usr/include/re_comp.h
/usr/include/linux/ppp-comp.h
/usr/include/linux/seccomp.h
/usr/include/net/ppp-comp.h
/usr/include/openssl/comp.h
/usr/lib/gcc/x86_64-linux-gnu/4.8/include/omp.h
/usr/lib/perl/5.18.2/CORE/regcomp.h
/usr/src/linux-headers-3.13.0-24/arch/arm/include/asm/seccomp.h
/usr/src/linux-headers-3.13.0-24/arch/microblaze/include/asm/seccomp.h
/usr/src/linux-headers-3.13.0-24/arch/mips/include/asm/seccomp.h
/usr/src/linux-headers-3.13.0-24/arch/powerpc/include/uapi/asm/seccomp.h
/usr/src/linux-headers-3.13.0-24/arch/s390/include/asm/seccomp.h
/usr/src/linux-headers-3.13.0-24/arch/sh/include/asm/seccomp.h
/usr/src/linux-headers-3.13.0-24/arch/sparc/include/asm/seccomp.h
/usr/src/linux-headers-3.13.0-24/arch/x86/include/asm/seccomp.h
/usr/src/linux-headers-3.13.0-24/include/linux/ppp-comp.h
/usr/src/linux-headers-3.13.0-24/include/linux/seccomp.h
/usr/src/linux-headers-3.13.0-24/include/net/ipcomp.h
/usr/src/linux-headers-3.13.0-24/include/uapi/linux/ppp-comp.h
/usr/src/linux-headers-3.13.0-24/include/uapi/linux/seccomp.h
/usr/src/linux-headers-3.13.0-24-generic/include/config/seccomp.h
/usr/src/linux-headers-3.13.0-24-generic/include/config/crypto/pcomp.h
/usr/src/linux-headers-3.13.0-24-generic/include/config/inet/ipcomp.h
/usr/src/linux-headers-3.13.0-24-generic/include/config/inet6/ipcomp.h
/usr/src/linux-headers-3.13.0-24-generic/include/config/isdn/ppp/bsdcomp.h
/usr/src/linux-headers-3.13.0-24-generic/include/config/ppp/bsdcomp.h
/usr/src/linux-headers-3.13.0-24-generic/include/config/xfrm/ipcomp.h
/usr/src/linux-headers-3.13.0-24-generic/include/linux/ppp-comp.h
/usr/src/linux-headers-3.13.0-24-generic/include/linux/seccomp.h
đây là makefile của tôi:
# Requires the following project directory structure:
# /bin
# /obj
# /src
# Use 'make remove' to clean up the whole project
# Name of target file
TARGET = main
CXX = clang++
CFLAGS = -std=c++11 \
-Weverything -Wall -Wextra -Wold-style-cast -Wpointer-arith -Wcast-qual \
-Wno-missing-braces -Wempty-body -Wno-error=uninitialized \
-Wno-error=deprecated-declarations -Wno-c++98-compat \
-pedantic-errors -pedantic \
-Os -fopenmp
LINKER = clang++ -o
LFLAGS = -Wall -Weverything -pedantic
SRCDIR = src
OBJDIR = obj
BINDIR = bin
SOURCES := $(wildcard $(SRCDIR)/*.cpp)
INCLUDES := $(wildcard $(SRCDIR)/*.h)
OBJECTS := $(SOURCES:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
RM = rm -f
$(BINDIR)/$(TARGET): $(OBJECTS)
@$(LINKER) [email protected] $(LFLAGS) $(OBJECTS)
@echo "Linking complete!"
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.cpp
@$(CXX) $(CFLAGS) -c $< -o [email protected]
@echo "Compiled "$<" successfully!"
.PHONEY: prepare
prepare:
mkdir -p bin
mkdir -p obj
.PHONEY: clean
clean:
@$(RM) $(OBJECTS)
@echo "Cleanup complete!"
@$(RM) tmp_file-*
@echo "Temporary files removed!"
.PHONEY: remove
remove: clean
@$(RM) $(BINDIR)/$(TARGET)
@echo "Executable removed!"
.PHONEY: run
run:
./bin/$(TARGET)
nó nói rằng – LxSwiss
OpenMP được hỗ trợ trong các phiên bản gần đây của Clang và GCC bây giờ. – coincoin
Đề xuất: CFLAGS = -I/usr/lib/gcc/x86_64-linux-gnu/4.8/bao gồm –