Using a library in Pelles C

Started by UnHeaded, February 21, 2012, 09:19:00 PM

Previous topic - Next topic

UnHeaded

Hi all,

I'm trying to add the FFTW library to my project (http://www.fftw.org/) and am confused as to how to do so!

Any help would be appreciated.
Many thanks.

Fayaaz

CommonTater

Pretty much follow the instructions here... http://www.fftw.org/install/windows.html

The project is available as precompiled DLLs so you can just put a copy in your project directory and include the .H file.

If you want to use a static library instead, you may have to compile from sources... but I'd try the DLL version first just to be sure it's what you want.

UnHeaded

I'm still a little bit confused. I've put all the files in the project directory but I still get the:
...
POLINK: error: Unresolved external symbol 'lfftw_print_plan_'.
POLINK: error: Unresolved external symbol 'lfftw_print_plan__'.
POLINK: error: Unresolved external symbol '__imp__fftw_plan_dft_r2c_2d@20'.

What do I do exactly?

CommonTater

Is the library or DLL compiled?  Most likely you'll need to make a separate project to compile it if not.

If it is correctly compiled, you should only have to place the single .lib and/or .dll into the folder with your project and then use #include  to add it's header to the project itself and tell the linker to use the .lib during compilation.

To get it to link with your files you can go to
(Menu) Project -> Project Options -> Linker ... add the .lib to the list of files to link to.
-or-
add  #pragma lib "libraryname.lib"  to the top of your source code.


UnHeaded

#4
Thank you very much for all your help.

All the .dlls are pre-compiled, no. lib files.
Still nothing working :/
Here's my code just for reference:

CommonTater

Quote from: UnHeaded on February 22, 2012, 01:48:33 AM
Thank you very much for all your help.

All the .dlls are pre-compiled, no. lib files.
Still nothing working :/

Ok... I'm going to have to step aside and ask one of the others who are more experienced with DLL files to help you from here.  I've never worked with DLLs without .lib files before.  I know it can be done, but I've never done it...

There are some pretty smart people here... so please be a little patient until they chime in...


TimoVJL

#6
Create import library with polib.exe
polib /DEF:libfftw3-3.def /OUT:libfftw3-3.lib /MACHINE:X86
TIP:
http://forum.pellesc.de/index.php?topic=3272.msg12340#msg12340
May the source be with you

UnHeaded

#7
Hey,

Thank you for your reply. Where exactly do I do this for a windows machine?

TimoVJL

In your project directory from commandline.

Or if you save this to for example Tools0.reg and insert it to register,
you can open that def-file from project directory in poide and create lib from menu Tools -> polib /DEF.
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Pelle Orinius\PellesC\Custom Tools\Tool0]
"Text"="polib /DEF"
"Command"="polib.exe"
"Arguments"="/DEF:$(FilePath) /OUT:$(FileName).lib"
"InitialDir"=""
"CaptureOutput"=dword:00000001
May the source be with you

CommonTater

Quote from: UnHeaded on February 22, 2012, 12:05:54 PM
Hey,

Thank you for your reply. Where exactly do I do this for a windows machine?

Unzip the downloaded archive into a directory... in there you will find the DLL and DEF files... I think Timo means to run polib in that folder... then copy the .h .dll and .lib to your project folder... that would give you the library you need for the linker settings...

Am I right Timo? 



TimoVJL

Yes, when i'm testing something, i just copy .h .dll .def .lib files to project directory.
It's easier to use those from there.

May the source be with you