I've defined two extern unsigned char
's in a header file for transfering two char
's between two classes. In the first .cpp
I use them like normal varibles to store the inputs i get from the function without any further declaration, like this:
test.h
extern unsigned char tempName;
extern unsigned char tempValue;
test.cpp
void NanoKontrol2::midi_in_proc(UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2) {
unsigned char ch_msg, data1, data2, data3;
switch (wMsg) {
case MIM_DATA:
ch_msg = (unsigned char)(0xFF & dwParam1);
data1 = (unsigned char)(0xFF & (dwParam1 >> 8));
data2 = (unsigned char)(0xFF & (dwParam1 >> 16));
data3 = (unsigned char)(0xFF & (dwParam1 >> 24));
/*on_message(ch_msg, data1, data2, data3);*/
tempName = data1;
tempValue = data2;
/*on_change_value(tempName, tempValue);*/
break;
default:
break;
}
}
Now I need the stored values in the tempVariables
from the midi_in_proc
in the second class needhere.cpp
.
I tried to use them in the class needhere.cpp
like this:
if (NK2_FADER_0 <= tempName && tempName <= NK2_FADER_7) {
fader1 = tempValue;
}
//Knobs
else if (NK2_ROTARY_KNOB_0 <= tempName && tempName <= NK2_ROTARY_KNOB_7) {
knob1 = tempValue;
}
Visual Studio doesn't show any Error. But when I try to compile I get this 6 Errors:
Severity Code Description Project File Line Suppression State
Error LNK1120 3 unresolved externals MayaNK2Node C:\Users 1
Error LNK2001 unresolved external symbol "public: static class NanoKontrol2 MayaNK2Node::nanoKONTROL2" (?nanoKONTROL2@MayaNK2Node@@2VNanoKontrol2@@A 1
Error LNK2001 unresolved external symbol "unsigned char tempName" (?tempName@@3EA)
Error LNK2001 unresolved external symbol "unsigned char tempName" (?tempName@@3EA)
Error LNK2001 unresolved external symbol "unsigned char tempValue" (?tempValue@@3EA)
Error LNK2001 unresolved external symbol "unsigned char tempValue" (?tempValue@@3EA)