【发布时间】:2014-01-06 00:40:05
【问题描述】:
我已经获得这些 LNK2019 有一段时间了,但似乎无法找到摆脱它们的方法。我知道已经有很多关于这些错误的线程,但我还没有找到任何对我有帮助的东西,所以希望有人可能会错过一些我可能错过的明显明显的东西。
我学的不是很传统,如果我的代码有点乱,请见谅。
主要:
#include "eventLoop.h"
#include <time.h>
#include <iostream>
using namespace std;
bool buttonA, buttonB, buttonC, buttonD, buttonE, buttonF, buttonG = false;
bool KeepProgramOpen = true;
time_t timer;
time_t oldtime;
time_t dtime;
time_t looptime;
int rate;
char Note;
bool FirstLoop = true;
eventLoop MainEventLoop;
int main()
{
rate = 60;
looptime = 1000 / rate;
while(KeepProgramOpen==true)
{
time(&timer);
dtime = timer-oldtime;
if(dtime<looptime)
{
continue;
}
oldtime = timer;
MainEventLoop.FindFinalNote(buttonA, buttonB, buttonC, buttonD, buttonE, buttonF, buttonG, FirstLoop);
FirstLoop = false;
//Closing stuff goes here
}
}
eventLoop.h:
#pragma once
class eventLoop {
public:
void FindFinalNote(bool, bool, bool, bool, bool, bool, bool, bool);
protected:
};
eventLoop.cpp:
#include "eventLoop.h"
#include "MidiOutput.h"
#include "FileIO.h"
MidiOutput MidiOutputX;
FileIO fileioX;
void eventLoop::FindFinalNote(bool A, bool B, bool C, bool D, bool E, bool F, bool G, bool firstloop)
{
if(firstloop == true)
{
for (int loopindex=0; loopindex<10; loopindex++)
{
// Note[loopindex] = Filecheck for notes
}
MidiOutputX.FindDevice(
1, /*int argc number of ports*/
60, /*char argv argument vector - strings pointed to, i don't really get it*/
);
}
char Note[10];
int KeyIndex = 0;
FileIO::key CurrentKey;
CurrentKey = fileioX.RetrieveKey(KeyIndex);
for (int x = 0; x < 10; x++)
{
Note[x] = CurrentKey.Note[x];
}
// There's a bunch of simple if statements here, nothing I need to bore you with
}
MidiOutput.h:
#pragma once
class MidiOutput {
public:
void FindDevice(int, char);
void PlayNote(unsigned char);
void EndNote();
void CloseDevice();
protected:
};
MidiOutput.cpp:
#include "MidiOutput.h"
#include <Windows.h>
#include <mmsystem.h>
#include <stdio.h>
union { unsigned long word; unsigned char data[4]; } message;
int midiport;
HMIDIOUT device;
void FindDevice(int argc, char** argv)
{
if (argc < 2) {
midiport = 0;
} else {
midiport = atoi(argv[1]);
}
printf("Midi output port set to %d.\n", midiport);
midiOutOpen(&device, midiport, 0, 0, CALLBACK_NULL);
message.data[0] = 0x90; //command byte
message.data[1] = 60; //middle C
message.data[2] = 0; //volume, 0-100
message.data[3] = 0; //not used
}
void MidiOutput::PlayNote(unsigned char Note)
{
message.data[1] = Note;
message.data[2] = 100;
}
void MidiOutput::EndNote()
{
message.data[2] = 0;
}
void MidiOutput::CloseDevice()
{
midiOutReset(device);
midiOutClose(device);
}
确切的错误:
错误 1 错误 LNK2019: 函数“public: void __thiscall eventLoop::FindFinalNote( bool,bool,bool,bool,bool,bool,bool,bool)" (?FindFinalNote@eventLoop@@QAEX_N0000000@Z) C:\Users\Hilly\documents\visual studio 2010\Projects\GHX\GHX\eventLoop.obj GHX
错误 2 错误 LNK2019:未解析的外部符号 _imp_midiOutOpen@20 在函数“void __cdecl FindDevice(int,char * *)”(?FindDevice@@YAXHPAPAD@Z) C:\用户\Hilly\documents\visual studio 2010\Projects\GHX\GHX\MidiOutput.obj GHX
错误 3 错误 LNK2019:未解析的外部符号 _imp_midiOutClose@4 在函数“public: void __thiscall MidiOutput::CloseDevice(void)”(?CloseDevice@MidiOutput@@QAEXXZ) C: \Users\Hilly\documents\visual studio 2010\Projects\GHX\GHX\MidiOutput.obj GHX
错误 4 错误 LNK2019:未解析的外部符号 _imp_midiOutReset@4 在函数“public: void __thiscall MidiOutput::CloseDevice(void)”(?CloseDevice@MidiOutput@@QAEXXZ) C: \Users\Hilly\documents\visual studio 2010\Projects\GHX\GHX\MidiOutput.obj GHX
错误 5 error LNK1120: 4 unresolved externals C:\Users\Hilly\documents\visual studio 2010\Projects\GHX\Debug\GHX.exe GHX
在此先感谢,对代码墙感到抱歉,我不确定有什么必要。
【问题讨论】:
标签: lnk2019 unresolved-external