User forums > Help

Strange error (win32 API)

<< < (2/3) > >>

Biplab:

--- Quote from: TDragon on February 02, 2007, 06:10:07 pm ---
--- Quote from: Biplab on February 02, 2007, 06:03:06 pm ---I think there's a cast problem.

--- End quote ---
QFT. The original code demonstrates "C++-style casting" (functional notation) -- valid in C++ but not C.

--- End quote ---

Two possible solutions.
* Change the file extension to cpp.
or
* Add -x c++ as compiler option.

seel:
Oh, it was that simple eh? doh :lol:

Well, now i get another error...

Project   : Win32 Application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Program\CodeBlocks\PROJEKT\dslua sdk\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe       -IC:\Program\CodeBlocks\include -c mdi_unit.cpp -o .objs\mdi_unit.o
mingw32-g++.exe    -LC:\Program\CodeBlocks\lib -o "C:\Program\CodeBlocks\PROJEKT\dslua sdk\DSLuaSDK.exe" .objs\mdi_unit.o  .objs\mdi_res.res       -lgdi32 -luser32 -lkernel32  -mwindows
.objs\mdi_unit.o:mdi_unit.cpp:(.text+0x2d0): undefined reference to `InitCommonControls@0'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 12 seconds)
0 errors, 0 warnings

And here is where the function is located in the code

--- Code: ---...

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
   LPSTR lpszCmdParam, int nCmdShow)
{
   MSG  Msg;
   WNDCLASSEX WndClassEx;

   InitCommonControls();

   g_hInst = hInstance;

....

--- End code ---

Biplab:
Goto Project > Build Options menu. Then goto Linker tab. Add comctl32 to the Link libraries.

seel:
You sir are now officialy god. :lol: Thanks for the help. ;)

Biplab:

--- Quote from: seel on February 02, 2007, 06:47:15 pm ---You sir are now officialy god. :lol:
--- End quote ---

Don't elevate me to God. I won't be able to sleep tonight. ;) (It's time to sleep for me)


--- Quote from: seel on February 02, 2007, 06:47:15 pm ---Thanks for the help. ;)

--- End quote ---

You are most Welcome.  :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version