Я получаю эти LNK2019s на некоторое время и не могу найти способ избавиться от них. Я знаю, что на этих ошибках уже много потоков, но мне еще нужно найти что-нибудь, что помогло мне так надеяться, что кто-то может пропустить что-то очевидное, я, возможно, пропустил.LNK2019 & LNK1120 Неразрешенные внешние возможности Наверное, легкое исправление, но у меня настоящие проблемы
Я не узнал очень традиционно, извините, если мой код немного грязный.
главная:
#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: неразрешенный внешний символ "общественность: недействительный __thiscall MidiOutput :: FindDevice (интермедиат, голец)"? (FindDevice @ MidiOutput @@ QAEXHD @ Z), на которые ссылается функция «public: void __thiscall eventLoop :: FindFinalNote (bool, bool, bool, bool, bool, bool, bool, bool)» (? FindFinalNote @ eventLoop @@ QAEX_N0000000 @ Z) C: \ Пользователи \ Hilly \ documents \ visual studio 2010 \ Projects \ GHX \ GHX \ eventLoop.obj GHX
Ошибка 2 ошибки LNK2019: unresolv ed external symbol _ imp _midiOutOpen @ 20 ссылается на функцию «void __cdecl FindDevice (int, char * *)» (? FindDevice @@ YAXHPAPAD @ Z) C: \ Users \ Hilly \ documents \ visual studio 2010 \ Projects \ GHX \ GHX \ MidiOutput.obj GHX
ошибка 3 ошибка LNK2019: неразрешенный внешний символ _ имп _midiOutClose @ 4 ссылки в функции "общественности: недействительным __thiscall MidiOutput :: CloseDevice (аннулируются)"? (CloseDevice @ MidiOutput @@ QAEXXZ) C: \ Users \ Холмистая \ документы \ Visual Studio 2010 \ Projects \ GHX \ GHX \ MidiOutput.obj GHX
ошибка 4 ошибка LNK2019: неразрешенный внешний символ _ имп _midiOutReset @ 4 ссылается в функции «общественности: аннулированию __thiscall MidiOutput :: CloseDevice (Недействительными)»C (CloseDevice @ MidiOutput @@ QAEXXZ?): \ Users \ Холмистая \ документы \ Visual Studio 2010 \ Projects \ GHX \ GHX \ MidiOutput.obj GHX
Ошибка 5 Ошибка LNK1120 : 4 неразрешенных внешних C: \ Users \ Холмистая \ документы \ Visual Studio 2010 \ Projects \ GHX \ Debug \ GHX.exe GHX
Спасибо заранее, и жаль о стену кода, я не уверен, что нужно.
Возможный дубликат [Что такое неопределенная ссылка/неразрешенная ошибка внешнего символа и как ее исправить?] (Http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved- external-symbol-error-and-how-do-i-fix) –