簡體   English   中英

無法使OpenMP與CodeBlocks和GFortran一起使用

[英]Can't make OpenMP work with CodeBlocks and GFortran

由於某些原因,我無法使OpenMP與CodeBlocks和GFortran一起使用。 我嘗試了另一個IDE(Geany),它可以正常工作,但是使用CodeBlocks卻不能。 我必須說我在-fopenmp中包括了-fopenmp選項。

這是我測試過的簡單代碼。

program test
implicit none
integer i

!$OMP PARALLEL DO DEFAULT(PRIVATE)
Do i=1,10
Write(*,*) i
end do
!$OMP END PARALLEL DO

end program test

這是構建日志:

-------------- Build: Debug in TEST (compiler: GNU Fortran Compiler)---------------

gfortran.exe -Jobj\Debug\ -Wall  -g  -fopenmp    -c "C:\Users\tilter\Dropbox\Public\Code\Nova pasta\TEST\main.f95" -o obj\Debug\main.o
gfortran.exe  -o bin\Debug\TEST.exe obj\Debug\main.o    
obj\Debug\main.o: In function `test':
C:/Users/tilter/Dropbox/Public/Code/Nova pasta/TEST/main.f95:5: undefined reference to `GOMP_parallel_start'
C:/Users/tilter/Dropbox/Public/Code/Nova pasta/TEST/main.f95:5: undefined reference to `GOMP_parallel_end'
obj\Debug\main.o:C:/Users/tilter/Dropbox/Public/Code/Nova pasta/TEST/main.f95:6: undefined reference to `GOMP_parallel_start'
obj\Debug\main.o:C:/Users/tilter/Dropbox/Public/Code/Nova pasta/TEST/main.f95:6: undefined reference to `GOMP_parallel_end'
obj\Debug\main.o:C:/Users/tilter/Dropbox/Public/Code/Nova pasta/TEST/main.f95:8: undefined reference to `omp_get_num_threads'
obj\Debug\main.o:C:/Users/tilter/Dropbox/Public/Code/Nova pasta/TEST/main.f95:8: undefined reference to `omp_get_thread_num'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
6 errors, 0 warnings (0 minutes, 0 seconds)

我不知道我在這里想念什么...

我剛剛重新啟動Windows 7,它解決了該問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM