Sign in to follow this  
123abcd1983

problem of midiOutClose, midiOutOpen,.. where to get mmsystem.h and windows.h

Recommended Posts

123abcd1983    122
hi, Hi, I wish to use midi file, but there are some error happened when i called some midi function like midiOutClose, midiOutOpen, midiOutReset, and midiOutShortMsg. I think it's because i didn't include the library of the midi function. i check the msdn library, by using those function i only need to #include<windows.h> and #include<mmsystem.h>. Then i goto the "include" folder to check this 2 files, i found that this 2 files not exist in the "include" folder, just wondering when can i get these 2 files?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster

I'm using visual studio.Net 2003 version, hehe, sorry i already found this 2 files in ..../Vc7/PlatformSDK/Include

but I don't know why they cannot detect the midi function, do you have any idea what caused the problem, i already include these 2 files in my code

Quote:

#include /* required before including mmsystem.h */
#include /* multimedia functions (such as MIDI) for Windows


the error like below
Quote:

midiplay2 error LNK2019: unresolved external symbol __imp__midiOutOpen@20 referenced in function _main
midiplay2 error LNK2019: unresolved external symbol __imp__midiOutClose@4 referenced in function _main
midiplay2 error LNK2019: unresolved external symbol __imp__midiOutReset@4 referenced in function _main
midiplay2 error LNK2019: unresolved external symbol __imp__midiOutShortMsg@8 referenced in function _main
midiplay2 fatal error LNK1120: 4 unresolved externals

Share this post


Link to post
Share on other sites
Dave Hunt    4872
That's got nothing to do with headers and everything to do with what libraries you link to (or don't link to). You need to link with winmm.lib for those functions.

By the way, the VS documentation tells you exactly what headers and libraries you need for every function. Check the bottom of the documentation page for the midiOutOpen function. You'll see:
Quote:

Header: Declared in Mmsystem.h; include Windows.h.
Library: Use Winmm.lib.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this