詳解-画像処理プログラミングをC++にして写経してた時のエラーまとめ。随時更新

previous definition of "struct name"
conflicting declaration
old declaration
redefinition of

名前被り。
おまえさっきそれ定義したのにもっかいあるって言われてる。

expected identifier before '*' token

宣言がおかしい。

int,a;

みたいなこと。
意外と気づかないことがある。

ambiguating new declaration of

型宣言がおかしい。
ambiguateは曖昧にするって意味らしい。

expected initializer before numeric constant

constの宣言をdefine感覚でやってしまった。

int a = 0

の=を忘れてた。

undefined reference to `WinMain@16'

写経中だったのでmain()を書いてなかった。

expected initializer at end of input

] と } を間違えていた。いろんなエラーがあるときにこれが重なると見逃したりする。

invalid conversion from 'void*' to 'char*'

型の問題。暗黙的な変換はしてくれないのか.....。

void* a;
char* b;
b = a;

みたいな感じでエラーがでる。

void* a;
char* b;
b = (char*)a;

で暗黙的なものではなくす。mallocとかも同じらしい。

 too few arguments to function

関数に対する引数の数が少ない。if文の中で関数を使ったりすると括弧の位置がぐちゃぐちゃになっておこりがち。

cannot convert 'bool' to 'FILE*

比較する型が違うので怒られる。括弧の位置とかでおこりがち。

forbids converting a string constant to 'char*'

ファイル操作ででてきた。
型が若干違うことで怒られた。
const char* filename のはずなのに char* filename を渡してたっぽい。?

expected initializer before 'int'
 int main()

mainの前に何か定義していたりして、セミコロンをつけ忘れたときにでてくる。

'関数' was not declared in this scope

main のあとに関数を定義したままだとでてくる。

void aaa();
int main(){
//処理
}
void aaa(){
//詳しい処理
}

みたいにする。

'pow' was not declared in this scope

#include <cmath>
または
#include <math.h>
忘れ

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA