
ネットに載っていたものなのですが、エラーが出てしまい実行できません。
どこを直したらよいのかご教授ください。
#include <stdio.h>
#include <math.h>
#include "common.h"
#include "fftcore.h"
#define SIZE 16
void maketimedomain(double x[],int size)
{
int i;
for (i=0;i<size;i++) {
x[i]=sin((2*M_PI)*i/size);
}
}
main()
{
double timedomain[SIZE]; /*時間領域データ格納域*/
dcomplex_t fftwork[SIZE]; /*複素数作業領域*/
/*FFTの初期化*/
initfft(SIZE);
/*時間領域データの作成とファイル保存*/
maketimedomain(timedomain,SIZE);
savereal(timedomain,SIZE,"timedomain.txt");
/*FFT作業の準備のため,時間領域データを複素数作業領域へ*/
/*コピーとファイル保存*/
real2cmp(timedomain,fftwork,SIZE);
savecmp(fftwork,SIZE,"comptimedomain.txt");
/*FFT(順方向フーリエ変換)*/
/*作業領域fftworkの内容がスペクトルになる*/
/*得られたスペクトルのファイルへの保存*/
fft(1,fftwork,SIZE);
savecmp(fftwork,SIZE,"spectrum.txt");
}
そしてfftcore.h は
void savereal(double r[],int size,char *fname);
void savecmp(dcomplex_t c[],int size,char *fname);
void real2cmp(double r[],dcomplex_t c[],int size);
void cmp2real(dcomplex_t c[],double r[],int size);
void movecmp(dcomplex_t s[],dcomplex_t d[],int size);
void movereal(double s[],double d[],int size);
void compress(dcomplex_t x[],int size);
void expand(dcomplex_t x[],int size);
void makepower(dcomplex_t s[],double pow[],int size,int mode);
void makecross(dcomplex_t x[],dcomplex_t y[],dcomplex_t crs[],int size,int mode);
void makecohe(double psx[], double psy[], dcomplex_t crs[],double cohe[],int size);
/* mode -1:clear&calc, 0:calc&add, 0<m:calc,add&normarize by m */
void makecoheop(double pow[],double cohe[],double cohepow[],int size);
void makexfunc(double psx[], dcomplex_t crs[], dcomplex_t trans[],int size);
void hanning(dcomplex_t data[],int size);
void hamming(dcomplex_t data[],int size);
void rectwindow(dcomplex_t data[],int size,int lowerlimit,int upperlimit);
void fft(int cdir,dcomplex_t x[],int size);
void initfft(int fftsize);
void windowout(void);
そしてcommon.h は
typedef struct {
double real;
double image;
} dcomplex_t;
typedef struct {
double *firdfcoef;
double *firdfx;
int firdflen;
int ptr;
} firdf_t;
/*#define WORKSIZE 256
#define FREQDSIZE (WORKSIZE/2)+1*/
#ifndef M_PI
#define M_PI 3.14159265358979
#endif
になります。
No.1
- 回答日時:
さて・・・・
どんなエラーが出たんでしょうか・・・・・
エラーの中身が分からなければ何が起きたのかは分かりませんね
時数足りなくて一行だけ書けないところがあったのですが以下の通りです。
17 | main()
| ^~~~
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\kymt\AppData\Local\Temp\ccvwMcEA.o:gyouretu4.c:(.text+0x67): undefined reference to `initfft'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\kymt\AppData\Local\Temp\ccvwMcEA.o:gyouretu4.c:(.text+0x9d): undefined reference to `savereal'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\kymt\AppData\Local\Temp\ccvwMcEA.o:gyouretu4.c:(.text+0xbc): undefined reference to `real2cmp'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\kymt\AppData\Local\Temp\ccvwMcEA.o:gyouretu4.c:(.text+0xd8): undefined reference to `savecmp'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\kymt\AppData\Local\Temp\ccvwMcEA.o:gyouretu4.c:(.text+0xf4): undefined reference to `fft'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe:
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
関連するカテゴリからQ&Aを探す
おすすめ情報
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
最早開始時間と最遅完了時刻を...
-
【C++】関数ポインタの使い方
-
C言語 エラーの原因がわからな...
-
#define _CRT_SECURE_NO_WARNIN...
-
C言語での奇数の和
-
Haskellで関数を合成しようとす...
-
式は定数値が必要です」という...
-
C言語での引数の省略方法
-
未解決の外部シンボル _printf...
-
CStringの配列要素を関数で受け...
-
「指定されたキャストは有効で...
-
return 1L
-
複数桁10進数の*桁目だけを抽出...
-
任意の文字列のアルファベット...
-
入力された数字を大きい順に並...
-
C言語のプログラム作成について
-
【C++】行列データの読み込み
-
2次元配列とポインタの引数受け...
-
数字列を3桁ごとにカンマで区切...
-
C言語 配列と関数の練習問題
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
#define _CRT_SECURE_NO_WARNIN...
-
「指定されたキャストは有効で...
-
C言語での引数の省略方法
-
【C++】関数ポインタの使い方
-
C言語 エラーの原因がわからな...
-
複数桁10進数の*桁目だけを抽出...
-
return 1L
-
if と配列の組み合わせ
-
ラップ関数とはどんなものですか?
-
式は定数値が必要です」という...
-
数字列を3桁ごとにカンマで区切...
-
実数の整数部,小数部の取得
-
C言語でDxlibを使って3x3の奇数...
-
プログラムについて(UNIX)
-
acceptをalarmでタイムアウトさ...
-
C言語の課題です
-
エラー 添字が付けられた値が、...
-
CStringの配列要素を関数で受け...
-
最早開始時間と最遅完了時刻を...
-
入力された数字を大きい順に並...
おすすめ情報