|
From: <jos...@ya...> - 2001-04-10 09:11:08
|
Hi, There are several things that are not correct. I'll try to fix them all. --- John <10...@ic...> wrote: > > I am new to C++ programming and following tutorial from > www.winprog.org. Every thing in this tutorial worked fine with the > exception of two toolbar examples. Source code for one example is > from > toolbar_one.zip . Resouce file will need absolute path for bmp file > name. In both cases I am getting Linker error: Does it mean that the resource file gives an error or not? > f:\codelocal\new > folder\newproject\toolbar\toolbar_one.o(.text+0x38f):toolbar_one.c: > undefined reference to `InitCommonControls@0' Mingw compiler doesn't include lib files like VC++. You will have to do it manually. Goto Project options and click on Load object files Look for the file libcomctl32.a in the Lib folder. > > I tried to compile toolbar source code from Dev-C++ example folder ( > Dev-C++\Examples\MdiApp ) and got following Compiler error: > > > f:\codelocal\new folder\new folder\mdiunit.c: In function `BOOL > LoadFile(HWND__ *, CHAR *)': > f:\codelocal\new folder\new folder\mdiunit.c:30: warning: converting > NULL to non-pointer type > f:\codelocal\new folder\new folder\mdiunit.c: In function `BOOL > SaveFile(HWND__ *, CHAR *)': > f:\codelocal\new folder\new folder\mdiunit.c:62: warning: converting > NULL to non-pointer type > f:\codelocal\new folder\new folder\mdiunit.c: In function `int > WinMain(HINSTANCE__ *, HINSTANCE__ *, CHAR *, int)': > f:\codelocal\new folder\new folder\mdiunit.c:163: warning: converting > NULL to non-pointer type This is because you have #define STRICT and therefore you must cast the parameters. Don;t worry it's easy. The lines giving the error are CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); Just replace it with this one CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES)NULL, OPEN_EXISTING, (DWORD)NULL, (HANDLE)NULL); > Linker error: > f:\codelocal\new folder\new folder\mdiunit.o(.text+0x323):mdiunit.c: > undefined reference to `InitCommonControls@0' See above > I don't know what I am doing wrong. > > I tried to use new command InitCommonControlsEx ( MSND ToolBar Using > ) > but no luck. Also, ICC_BAR_CLASSES which should be defined in > commctrl.h > (folder Dev-C++\Include\commctrl.h) is not there, all the time it > gives > the error of undefined. Can some body tell me how to correct the > ICC_BAR_CLASSES in file commctrl.h. #define ICC_BAR_CLASSES 4 Among others, this definition is missing from Mingw header. I got an extra header file from someone, but don't remember the exact URL, including many features that Mingw does not cover yet. For some other definitons to work you need to use #define _WIN32_IE 0x0400 // defines IE version > I already installed twice the Dev-C++ thinking that I might have > corrupted some files, but no difference. It's not a Dev-C++ problem, it's just Mingw's characteristics Hope this helps Chemanuel __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |