I'm trying to build fftw2xf library, but I am having problems using the makefile. I've never used a makefile before, so that is probably the issue. I'm using VS2005, so I open up the command prompt through the VS interface (this sets the directory where nmake and cl files are) then I issue the command: nmake /F makefile libintel64 compiler=ms precision=MKL_SINGLE
I had problems with getting nmake to find the makefile so I just copied all the files in the fftw2xf folder into the VS\\bin folder where nmake.exe is. Then I used the same command again. I get the following result:' Microsoft Program Maintenance Utility Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved.
nmake PLAT=win32e clean lib ARCH=intel64 compiler=ms precision=MKL_SING LE
Microsoft Program Maintenance Utility Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved.
Copying the parts of MKL installation into VS\bin folder was wrong move. In theVS2005 command prompt window you should go to MKL\examples\fftw2xf folder (cd c:\Program Files\...etc...) and run 'nmakelibintel64 compiler=ms precision=MKL_SINGLE' in that folder.
Thanks, that did it. I was actually able to build the library by creating a new project in VS2005, but it was quite a bit of work and the .lib that it produced was very large. Now that I got the .lib to build with the makefile, I'm having problems linking to it from my main project. It should be as simple as copying the .lib file into my source code directlory for my VS2005 project. And then add the library name "fftw2xf_ms.lib" as an additional dependency in the project properties. I'm using the original fftw header files. When I try to compile the project I get link errors like this:
error LNK2019: unresolved external symbol rfftwnd_one_real_to_complex referenced in function "struct _array_2d_ * __cdecl Real2DFFT(struct _array_2d_ *)"
Which tells me that the fftw2xf_ms.lib is not being recognized or its functions are not exposed correctly. Is there something else I should be doing to get my project to link to the fftw2xf_ms.lib?
I have still been unable to solve the link errors, but I may know why they are occuring. I compiled my main project for win32, as opposed to x64 that I was trying, and the link errors are gone. So most likely the fftw2xf_ms.lib is not being recognized by the linker because it is x86 and not x64. I verified this by setting a linker command to link for x64 when using the makefile to build the fft lib. I get an error saying that the obj files are not for x64. Is there a way I can force the compiler to compile x64 .obj files? I tried setting the PATH environment variable so cl.exe would be called from my Program Files folder(which is the x64 folder) rather than the Program Files (x86) folder. This gave me some error messages as well. Any ideas?
At the command prompt where you built the fft lib you can issue command 'cl -V' and seethe compiler banner. If it says '... for 80x86' then it is 32-bit compiler of course, and the 32-bit library should be build with 'nmake libia32 ...'. If the compiler says '... for x64' then the 64-bit fftw2 library should be build with 'nmake libintel64 ...'. Probably it is the environment mess that confuses the tools. VS provides environment setters that do this in a more elaborate way than just setting PATH. For instance, to arrangefor x64 development in a command prompt window one is expected to run "c:\Program Files (x86)\Microsoft Visual Studio \VC\vcvarsall.bat x64". I hope this helps. Dima
Thanks again Dima. Yesterday I was trying to find exactly what you were describing in regards to the x64 vars.bat file. I couldn't find it in either versions of VS that I have installed. When you mentioned that that was the proper way I searched again. I looked at the vcvarsall.bat file and noticed that one of the options was amd64. I don't have an amd64 processor, but I gave it a try anyway. So I used the vcvarsamd64.bat file inside the ...\VC\bin\amd64 folder and everything compiled for 64-bit(x64). I linked this lib to my x64 project and everything compiles fine now. Why does Microsoft call the folder "amd64" when it's actually x64? It confuses me.
MS uses two names for the same thing. For instance, the 'vcvarsall.bat' file I mentioned contains these lines:
[bash]if /i %1 == amd64 goto amd64
if /i %1 == x64 goto amd64
if not exist "%~dp0binamd64vcvarsamd64.bat" goto missing
MS VS installation should provide start menu item like 'Microsoft Visual Studio->...->Visual Studio Command Prompt for x64 development' which is supposed to open command window with proper environment.