1

I've downloaded kiss fft from here .But I don't know really know how to use it in Visual Studio. For example, after I create an empty win32 project in Visual Studio, how should I copy paste the files in the zip file and change the command in the profile such that I can use all the functions in the kiss fft library?

Thanks for helping me out!

Cancan
  • 691
  • 3
  • 14
  • 23
  • What's in the zip file? libs and header files? – doctorlove Aug 04 '13 at 16:27
  • There are some other miscellaneous files such as READE, etc. But it seems it can't compile if I just include the file in the first directory. There are 1 .c file and 3 header files. The compiler reports "unresolved externals" don't know if I should also do something in external dependencies – Cancan Aug 04 '13 at 16:30

1 Answers1

3

If you have header (h) and and source (c) files in the zip, right click on your new empty project and add (the unzipped copies of) them.
You will need to set the include path to where they reside, so you can #include the header files you want.
And "unresolved externals" means it's seen a declaration, e.g. in a header file, but cannot find the definition.
Watch out for #including header files to C source in a C++ project. If you've included the source it will be looking for C++ unless you say otherwise. You will need to do this

extern "C" {
#include "fft_header.h"
}

Further details here


EDIT OK, I downloaded the files, made an empty Win32 console app, selected empty project, added the path to the additional include in the project. enter image description here Then I added a main file as follows along with adding the C file you mention in the download.

extern "C"
{
    #include "kiss_fft.h"
}

int main()
{
    kiss_fft_cfg cfg;
    kiss_fft_cpx *fin;
    kiss_fft_cpx *fout;
    kiss_fft(cfg, fin, fout);
}

I have warnings but no link errors.

Community
  • 1
  • 1
doctorlove
  • 18,872
  • 2
  • 46
  • 62
  • it seems it still doesn't work if I add extern "C". Actually, there are only three files, could you please check how to fix this compile error? kiss_fft.c kiss_fft.h _kiss_fft_guts.h in the first directory of zip file. – Cancan Aug 04 '13 at 16:49
  • 1
    You need to put more details about what exactly you are doing cos it works for me – doctorlove Aug 04 '13 at 16:58
  • Currently, I just want those 3 files to compile, that's it. And then I'll try to figure out the details of the code. And in which file do you #include "kiss_fft.h" and in which file do you create int main()? Sorry that I am not a good C programmer, so I am not sure if it can work without int main; – Cancan Aug 04 '13 at 17:01
  • Sorry, for the confusion. I add one test file more from the zip file folder "test" called testcpp.cc but it seems it reports it can't kissfft.hh do you know what happened? – Cancan Aug 04 '13 at 17:07
  • Yea, exactly, no matter, what test files I add, the compiler always told me "can't open the file" – Cancan Aug 04 '13 at 17:14
  • 1
    " added the path to the additional include in the project" means right click on your project, under properties (bottom of context menu) go to "C/C++ | General | Additional Include Directories" and say where you put the header – doctorlove Aug 04 '13 at 17:21
  • 1
    @Cancan see screen shot. BTW my main function went in a new soruce file I made, called main.cpp, which I added to my empty project – doctorlove Aug 04 '13 at 17:24