pthreads を含むコードをコンパイルしようとすると、次のようなエラーが発生しました。
warning: return type defaults to 'int' [-Wreturn-type]|
|In function 'print_message_function':|
warning: control reaches end of non-void function [-Wreturn-type]|
| undefined reference to `_imp__pthread_create'|
| undefined reference to `_imp__pthread_create'|
| undefined reference to `_imp__pthread_join'|
| undefined reference to `_imp__pthread_join'|
Windows 7 で GCC を実行していますが、mingw がインストールされています。私は IDE Code::Blocks を使用しており、「現在のファイルをコンパイルする」を選択しています。これはリンカー設定のスクリーンショットです。ここで途方に暮れています
更新:-pthread
「その他のリンカーオプション」に追加したところ、よりうまく機能します。まだ問題があります。コンパイルすると、
|In function 'print_message_function':|
warning: control reaches end of non-void function [-Wreturn-type]|
CodeBlocks を実行すると、「プログラムはまだビルドされていないようです」と表示され、「ビルド」をクリックすると、このエラーが表示されます
mingw32-g++.exe -o "SimpleExample.exe" "SimpleExample.o" -static-libgcc -static-libstdc++ -pthread
mingw32-g++.exe: error: unrecognized option '-pthread'
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 1 warnings (0 minutes, 0 seconds)
これを修正するにはどうすればよいですか? Windows でビルド/テストしたいのですが、プログラムを Unix 環境で実行します。IDE でのコンパイルとビルドの違いは何ですか?