0

何らかの理由で、OpenMP を CodeBlocks と GFortran で動作させることができません。別の IDE (Geany) を試してみましたが、正しく動作しますが、CodeBlocks では動作しません。-fopenmpこのオプションを CodeBlocks に含めたと言わざるを得ません。

これは私がテストした簡単なコードです。

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)

ここで何が欠けているのかわかりません...

4

1 に答える 1

0

Windows 7を再起動したところ、問題は修正されました。

于 2013-07-20T21:14:28.047 に答える