clMathLibraries / clFFT

a software library containing FFT functions written in OpenCL
Apache License 2.0
619 stars 192 forks source link

How to compile code which uses clFFT? #224

Open kevin9105 opened 6 years ago

kevin9105 commented 6 years ago

Hi, I'm trying to compile my test code using clFFT, with visual studio, but I have a problem which says: unresolved external symbol imp_clfftTeardown referenced in function main unresolved external symbol __imp_clfftSetup referenced in function main unresolved external symbol imp_clfftSetResultLocation referenced in function main and so on (Total 9 unresolved external symbol __imp_clfft~~ referenced in function main).

I installed MinGW-w64 to my laptop (Windows 10 64 bit) where visual studio 2015 is installed, installed CMake 3.12.2, and built boost_1_54_0 by following clFFT wiki. However, visual studio cannot find boost even though I followed the clFFT wiki, so I deleted and built boost_1_54_0 again with the help of MinGW-w64 wiki. After that, I searched google how to install clFFT, and found it: I entered the command, cmake ../src -G "MSYS Makefiles", and now boost_1_54_0 is recognized, and I installed clFFT.

I installed clFFT to D:/clfft64. clAmdFft.h, clAmdFft.version.h, clFFT.h, clFFT.version are in D:/clfft64/package/include, libclFFT.dll.a and libStatTimer.dll.a are in D:/clfft64/package/lib64/import, and libclFFT.dll in D:/clfft64/package/bin.

After installing clFFT, I wrote my test code using visual studio. I added "D:\clfft64\package\include" to the Additional Include Directories, and added "D:/clfft64/package/lib64" and "D:\clfft64\package\bin" to the Additional Library Directories (Of course, since I'm using OpenCL with Intel SDK, I added $(INTELOCLSDKROOT)\include to the Additional Include Directories, $(INTELOCLSDKROOT)\lib\x64 to the Additional Library Directories, and OpenCL.lib to the Additional Dependencies).

Did I miss something? If you know, please let me know. I'm a complete newbie about compiling, so I'm confused... Thank you for your help in advance. If you know how to write CMakeLists.txt for the following case, it would be a great help to me: I made a simple test code with mytestcode.c. "mytestcode.h" (cl.h is included in there) and "clFFT.h" should be added to mytestcode.c.

For example, mytestcode.c begins with

define _CRT_SECURE_NO_WARNINGS

define CL_USE_DEPRECATED_OPENCL_2_0_APIS

include "mytestcode.h"

include

int main(int argc, char **argv) { blahblahblah }

and mytestcode.h begins with

define MAX(a, b) (a > b) ? a : b

define MIN(a, b) (a < b) ? a : b

include

include

include

include

include

include

ifdef APPLE

include <OpenCL/opencl.h>

include

else

include <CL/cl.h>

endif

blahblahblah