compiling mingw to enable timeSetEvent

This is a discussion on compiling mingw to enable timeSetEvent within the Windows Programming forums, part of the Platform Specific Boards category; Hello, this is how I currently compile my app: Code: windres -o stuff.o something.rc gcc -o output -mwindows stuff.o mainfile.c ...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    108

    compiling mingw to enable timeSetEvent

    Hello,

    this is how I currently compile my app:

    Code:
    windres -o stuff.o something.rc
    gcc -o output -mwindows stuff.o mainfile.c
    output
    this is mingw for windows, obtained from dev-c++'s included compiler.
    The problem is that it does not recognise the function timeSetEvent, even though I included <windows.h> and <mmsystem.h>. And timeSetEvent is declared in the header file, as I checked, but mingw still doesn't support it.

    I was wondering if I'm missing a mingw flag?

    so recently I downloaded the free vc++ 2003 compiler.. what flags would I need if i were to use it? Does it even support win32 API?

    thanks again!

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    At the bottom of the documentation page for timeSetEvent is:
    Code:
    Library: Use Winmm.lib.
    This means that you have to link with Winmm.lib to use that function. Add a library to the link using gcc's -l option:
    Code:
    gcc -o output -mwindows stuff.o mainfile.c -lwinmm
    To use the VC compiler with Windows functions, you will need to download the Platform SDK.

    You can then compile your code with a batch file like this:
    Code:
    :: This is for VC Toolkit 2003.
    call "C:\Program Files\Microsoft Visual C++ Toolkit 2003\vcvars32"
    
    :: Set environment variables for Platform SDK:
    SET INCLUDE=%INCLUDE%;C:\Program Files\Microsoft SDK\Include;
    SET LIB=%LIB%;C:\Program Files\Microsoft SDK\Lib;
    
    %0\
    cd %0\..
    cd /d %0\..
    
    cls
    
    cl /GF /W3 %1 KERNEL32.LIB USER32.LIB
    
    @del *.obj
    @echo.
    @pause
    This batch file will compile a file dragged onto it. Alternatively, you can replace %1 with the name of one or more files you wish to compile. A list of cl options is available here.
    Last edited by anonytmouse; 02-02-2005 at 05:48 PM.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    108
    oh wow, i can't believe I missed that. Thanks a lot, your help is very much appreciated

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help compiling example code (MinGW and DirectX9)
    By scwizard in forum Game Programming
    Replies: 10
    Last Post: 07-25-2008, 11:43 AM
  2. Quincy 2005: Compiling Errors
    By Thileepan_Bala in forum C Programming
    Replies: 6
    Last Post: 01-18-2008, 08:26 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. Free compiler for commercial development? (mingw?)
    By kook44 in forum Windows Programming
    Replies: 8
    Last Post: 01-07-2006, 09:32 AM
  5. Compiling Resources In MinGW
    By Okiesmokie in forum C++ Programming
    Replies: 2
    Last Post: 03-06-2002, 04:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21