![]() |
| | #1 |
| Registered User Join Date: Feb 2009
Posts: 8
| Visual C++ Linking with mmsystem.h Error 1 error LNK2028: unresolved token (0A000031) "extern "C" unsigned int __stdcall waveInGetNumDevs(void)" (?waveInGetNumDevs@@$$J10YGIXZ) referenced in function "public: __clrcall record::Form1::Form1(void)" (??0Form1@record@@$$FQ$AAM@XZ) record.objrecord I am assuming this has to do with managed and unmanaged code mixed together. So i made a header file referencing just the needed function and surrounded it with #pragma unmanaged and am compiling with /clr option. Here is the header file: Code: #sound.h #include "windows.h" #include "mmsystem.h" #pragma unmanaged WINMMAPI UINT WINAPI waveInGetNumDevs(void); Code: #include "sound.h"
#pragma managed
namespace record {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class Form1 : public System::Windows::Forms::Form
{
HWAVEIN hwin;
MMRESULT result;
int numDevices;
public:
Form1(void)
{
InitializeComponent();
numDevices = waveInGetNumDevs();
}
--koooee |
| koooee is offline | |
| | #2 |
| Registered User Join Date: Jan 2002 Location: Northern Virginia/Washington DC Metropolitan Area
Posts: 2,787
| mmsystem.h is a header and you don't link with headers, you link with libraries. There is probably a library you need to explicitly link with (winmm.lib if I'm not mistaken) in your project settings.
__________________ On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. --Charles Babbage, 1792-1871 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 |
| hk_mp5kpdw is offline | |
| | #3 |
| Registered User Join Date: Feb 2009
Posts: 8
| i feel stupid....(that was in my console version of the code) thanks for the reply. if anyone is wondering...put this line in stdafx.h Code: #pragma comment(lib, "winmm.lib") |
| koooee is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| We Got _DEBUG Errors | Tonto | Windows Programming | 5 | 12-22-2006 05:45 PM |
| C++ std routines | siavoshkc | C++ Programming | 33 | 07-28-2006 12:13 AM |
| load gif into program | willc0de4food | Windows Programming | 14 | 01-11-2006 10:43 AM |
| Errors with including winsock 2 lib | gamingdl'er | C++ Programming | 3 | 12-05-2005 08:13 PM |
| Learning OpenGL | HQSneaker | C++ Programming | 7 | 08-06-2004 08:57 AM |