NO

Author Topic: Using a library in Pelles C  (Read 10501 times)

UnHeaded

  • Guest
Using a library in Pelles C
« on: February 21, 2012, 09:19:00 PM »
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

  • Guest
Re: Using a library in Pelles C
« Reply #1 on: February 21, 2012, 10:01:49 PM »
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

  • Guest
Re: Using a library in Pelles C
« Reply #2 on: February 22, 2012, 01:26:47 AM »
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

  • Guest
Re: Using a library in Pelles C
« Reply #3 on: February 22, 2012, 01:42:05 AM »
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

  • Guest
Re: Using a library in Pelles C
« Reply #4 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 :/
Here's my code just for reference:
« Last Edit: February 23, 2012, 12:43:52 AM by UnHeaded »

CommonTater

  • Guest
Re: Using a library in Pelles C
« Reply #5 on: February 22, 2012, 03:04:57 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...


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Using a library in Pelles C
« Reply #6 on: February 22, 2012, 08:22:44 AM »
Create import library with polib.exe
Code: [Select]
polib /DEF:libfftw3-3.def /OUT:libfftw3-3.lib /MACHINE:X86TIP:
http://forum.pellesc.de/index.php?topic=3272.msg12340#msg12340
« Last Edit: February 22, 2012, 08:58:11 AM by timovjl »
May the source be with you

UnHeaded

  • Guest
Re: Using a library in Pelles C
« Reply #7 on: February 22, 2012, 12:05:54 PM »
Hey,

Thank you for your reply. Where exactly do I do this for a windows machine?
« Last Edit: February 22, 2012, 12:23:09 PM by UnHeaded »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Using a library in Pelles C
« Reply #8 on: February 22, 2012, 02:56:38 PM »
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.
Code: [Select]
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

  • Guest
Re: Using a library in Pelles C
« Reply #9 on: February 22, 2012, 06:47:24 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? 



Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Using a library in Pelles C
« Reply #10 on: February 22, 2012, 06:59:14 PM »
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