Menu

fftw compiling errors

theH
2008-03-12
2012-09-26
  • theH

    theH - 2008-03-12

    I am attempting to get fftw running from the fftw-2.1.5-1spec.DevPak designed for c++.
    (I'm using Dev-C++ 4.9.9.2 running on WinXP) The basic program reads as:

    include <iostream>

    include <math.h>

    include <stdio.h>

    include <fstream>

    include <fftw.h>

    fftw_plan fftw_create_plan(int n, fftw_direction dir, int flags);
    using namespace std;

    int main()
    {
    int i, N = 16;
    double fx[N];
    double dx = 2*3.1415/N;
    fftw_complex in[N], out[N];
    fftw_plan p;
    p = fftw_create_plan(N, FFTW_FORWARD, FFTW_ESTIMATE);

    for(i=0;i&lt;N;i++)
    {
                    fx[i] = 0.5*cos(i*dx)+0.25*cos(6*i*dx)+0.125*cos(12*i*dx);
                    in[i].re= fx[i];
                    in[i].im= 0;
                    cout&lt;&lt; fx[i]&lt;&lt;endl;
    }
    
    fftw_one(p, in, out);
    cin.get();
    
    fftw_destroy_plan(p);
    
    return 0;
    

    }

    The compiler log reads:
    Compiler: Default compiler
    Executing g++.exe...
    g++.exe "C:\Documents and Settings\Brian\Desktop\CPPWorks\hw4e.cpp" -o "C:\Documents and Settings\Brian\Desktop\CPPWorks\hw4e.exe" -ansi -fexceptions -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lobjc
    C:\Dev-Cpp\Bin..\lib\gcc\mingw32\3.4.2........\mingw32\bin\ld.exe: cannot find -lobjc
    collect2: ld returned 1 exit status
    Execution terminated

    If I'm going about the implementation wrong, it would be good to know. The program should take the fourier transformation of the fx array and return it in out (near as I can tell).
    Most of the context was taken straight from the fftw2 documentation at fftw.org. I changed the compiler options to "link an objective C program" which dismissed most of the orignial [linker error]'s but replaced it with "cannot find -logjc. Any assistance would be appreciated, thanks.

     
    • cpns

      cpns - 2008-03-13

      Oh... I missed that bit at the end! Don't change anything unless you know what it is for. You got no linker errors because the linker failed to even run!

      You would do well to post the original log before you screwed it up.

      Clifford

       
    • cpns

      cpns - 2008-03-12

      You have told the compiler to link an Objective-C program.

      Apart from the fact that you probably did not intend to do that (which begs the question why you did!?), if you do you need to download additional support files for it. You need to disable the option in teh project settings.

      Objective-C is a different language used primarily on NeXT and OSX.

      Regarding the path "C:\Documents and Settings\Brian\Desktop\CPPWorks\&quot; you should read the "PLEASE READ BEFORE POSTING A QUESTION" thread, especially with respect to its advice on not using paths containing spaces.

       
    • Wayne Keen

      Wayne Keen - 2008-03-13

      Don't be under the illusion that adding the -lobjc option fixed anything. It
      just replaced put an error in front of your other errors that stopped things
      before it got to yours.

      Wayne

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.