環境
Windows10 64bit
vs2015(開発用コマンドプロンプトのみ)
OpenCV-MinGW-Buildhttps
このサイトhttp://d.hatena.ne.jp/Inuneco/20110714/p1に書いてあるopencvのプログラムをヘッダファイルなしで書き直したいのですが、どのようにすればよいでしょうか?
#include <cv.h> #include <highgui.h> int main () { cvNamedWindow ("test", CV_WINDOW_AUTOSIZE); cvWaitKey (0); cvDestroyWindow ("test"); return 0; }
私個人で書いたものはこちらです。
できる限りopencvの参考書とc言語の参考書で頑張ったのですが最後のエラーが解決できずにいます。
#define cvNamedWindow; int cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) ); CV_WINDOW_AUTOSIZE = 0x00000001;//the user cannot resize the window, the size is constrainted by the image displayed int main () { cvNamedWindow ("test", CV_WINDOW_AUTOSIZE); cvWaitKey (0); cvDestroyWindow ("test"); return 0; }
エラーがこちらです。
C:\Users\Daito\Desktop\NamedWindow.c:3:22: warning: ISO C99 requires whitespace after the macro name #define cvNamedWindow; ^ C:\Users\Daito\Desktop\NamedWindow.c:4:1: warning: useless type name in empty declaration int cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) ); ^~~ C:\Users\Daito\Desktop\NamedWindow.c:4:20: error: expected identifier or '(' before 'const' int cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) ); ^~~~~ C:\Users\Daito\Desktop\NamedWindow.c:5:1: warning: data definition has no type or storage class CV_WINDOW_AUTOSIZE = 0x00000001;//the user cannot resize the window, the size is constrainted by the image displayed ^~~~~~~~~~~~~~~~~~ C:\Users\Daito\Desktop\NamedWindow.c:5:1: warning: type defaults to 'int' in declaration of 'CV_WINDOW_AUTOSIZE' [-Wimplicit-int] C:\Users\Daito\Desktop\NamedWindow.c: In function 'main': C:\Users\Daito\Desktop\NamedWindow.c:11:1: warning: implicit declaration of function 'cvWaitKey' [-Wimplicit-function-declaration] cvWaitKey (0); ^~~~~~~~~ C:\Users\Daito\Desktop\NamedWindow.c:13:1: warning: implicit declaration of function 'cvDestroyWindow' [-Wimplicit-function-declaration] cvDestroyWindow ("test"); ^~~~~~~~~~~~~~~
どうかよろしくお願いいたします。
ヘッダファイルなしのプログラムにこだわるのはヘッダファイル 自体に無駄が多いため、ソースコードとは関係ないものでエラーを出すためです。cc~~~~
出来れば解決までの過程なども教えていただけると助かります。