如何解决错误LNK2019:未解析的外部符号
How to solve error LNK2019: unresolved external symbol
我的老师给了我以下代码来制作一个带有波形可视化的录音机程序。但是,我坚持使用下面显示的错误。
。中国共产党
#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";
资源2.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
我一直收到错误:
错误 LNK2019:未解析的外部符号imp__waveOutOpen@24 在函数"long __stdcall WindowProcedure(struct HWND *,无符号整数,无符号整数,长整型)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z) 错误LNK2019:未解决 函数中引用的外部符号imp__waveInPrepareHeader@12 "long __stdcall WindowProcedure(struct HWND *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z) 1>录音机.obj : 错误 LNK2019:未解析的外部符号imp__waveInOpen@24 在函数"long __stdcall WindowProcedure(struct HWND *,无符号整数,无符号整数,长整型)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z)
请告诉我如何解决这个问题,我已经挠头几个小时了。
这不是全部代码,因为其中没有调用这些函数。它们是winmm.dll
中定义的Windows函数,因此链接到winmm.lib
。具体如何做到这一点取决于您的编译器。
相关文章:
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- 未解析的外部符号_MsiLocateComponentW@12.
- 在C++中使用 gRPC 时未解析的外部符号
- LibPrivoxy: 未解析的外部符号 __declspec(dllimport) int __stdcall Sta
- 尝试从 XamlApplication 编译 C++/WinRT 空白应用程序时,我收到未解析的外部符号 winrt_make_*
- 我收到错误LNK2001:未解析的外部符号(C++代码)
- 可视抽象类 c++(错误 LNK 2001:未解析的外部符号)
- 如何摆脱C++中未解析的外部符号"private: static char"错误?
- 当 lib 已添加到其他依赖项时,如何在 VS 中调试未解析的外部符号错误
- 仅在少数方法(静态或共享库)中解析的外部符号
- 未解析的外部符号"__declspec(dllimport)与 Spdlog c++ 库
- 函数 _main (OPENGL C++) 中引用的未解析的外部符号 ________
- 错误LNK2019未解析的外部符号"public: __thiscall SLinkList<char>::SLinkList<char>(void)"
- 使用静态 constexpr 成员的未解析外部符号
- 引入参数化构造函数后显示 LNK 2019 未解析外部符号的代码错误
- Dlib LNK2001未解析的外部符号USER_ERROR__consistent_build_configurati
- 矛盾的未解决的外部符号+未使用的库与VS2017和FFMPEG 4
- 链接器错误:切换到unicode生成给出:未解析的外部符号WinMain
- 错误 LNK2019:未解析的外部符号"外部"C"此错误是什么?
- 错误 : LNK2019: 未解析的外部符号"外部 "C"