-6

My teacher has given me the following code to produce a sound recorder program with wave visualisation. However im stuck with the errors that are shown below.

.ccp

#include "StdAfx.h"
#include "resource2.h"

using namespace std;


//Globals for sound wave visualistion

int number, length, byte_samp, byte_sec, bit_samp;

static int sampleRate = 11025;

const int NUMPTS = 11025 * 10;

bool mono = TRUE;

bool PLAY = FALSE;

errno_t wavfile;

char * filename;

int s_rate = 11025;

double limit = 10000.0;

FILE * stream;

/*  Declare Windows procedure  */

LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/* Declare procedures */

int readSample(int number,bool leftchannel);

void SaveWavFile(char *FileName, PWAVEHDR WaveHeader);

void Wav(char *c, HWND hWnd);

/*  Make the class name into a global variable  */

char szAppName[ ] = "Recorder";

resource2.h

#ifndef RESOURCE_H_INCLUDED

#define RESOURCE_H_INCLUDED

#define INP_BUFFER_SIZE 16384

#define IDC_RECORD 1

#define IDC_PLAY 2

#define IDC_STOP 3

#define NUM 20000

//defines for menu

#define APP_SAVE 1003

#define APP_EXIT  1004
#endif // RESOURCE_H_INCLUDED

I have been getting the errors:

Error LNK2019: unresolved external symbol imp__waveOutOpen@24 referenced in function "long __stdcall WindowProcedure(struct HWND *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z) Error LNK2019: unresolved external symbol imp__waveInPrepareHeader@12 referenced in function "long __stdcall WindowProcedure(struct HWND *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z) 1>recorder.obj : error LNK2019: unresolved external symbol imp__waveInOpen@24 referenced in function "long __stdcall WindowProcedure(struct HWND *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z)

Please tell me how to solve this , i have been scratching my head for hours.

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325

1 Answers1

1

That isn't all the code, since those functions weren't called in it. They are Windows functions defined in winmm.dll, so link to winmm.lib. Exactly how to do that depends on your compiler.

Mark Tolonen
  • 166,664
  • 26
  • 169
  • 251