Funkcja w main bład podczas kompilacji

0

Witam wszystkich mam taki kod w c++

//includy
#include <windows.h>
#include <stdio.h>

#define C 	33
#define D 	37
#define E 	41
#define F 	44
#define G 	49
#define A 	55
#define H 	62
#define C2 	65

#define CALA 80
#define POL 40
#define CWIERC 20
#define OSEMKA 10

typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum);

int main(int argc, char *argv[]) { 
//ładowanie biblioteki inpout32.dll
HINSTANCE Biblioteka; 
oupfuncPtr OutPort;
Biblioteka = LoadLibrary("inpout32.dll"); 
if(Biblioteka)
{
	OutPort = (oupfuncPtr) GetProcAddress(Biblioteka, "Out32"); 
}
else
MessageBox(NULL,"Nie znaleziono pliku inpout32.dll","Błąd",MB_OK);
//*********************************************************** 

SendCommand(C, CWIERC);


FreeLibrary (Biblioteka);              
system("PAUSE"); 
return EXIT_SUCCESS; 
}


int SendCommand (int nuta, int typ)
{
for (int i=0; i<typ; i++)
	{
		OutPort(0x378, 00000003);
		Sleep(10);
		OutPort(0x378, 00000002); 
		Sleep(10);
	}
	Sleep(nuta);
	return 1;
}
 

Podczas kompilacji mam errory

1. In function 'int main(int, char)':
2. [Error] 'SendCommand' was not declared in this scope
3. In function 'int SendCommand(int, int)':
4. [Error] 'OutPort' was not declared in this scope**

Chce po prostu w main móc wywoływać funkcje SendCommand
Jestem początkujący i nie wiem jak mam to zrobić

0

Całą funkcje SendCommand przenieś przed main lub przed main dodaj samą definicje:
int SendCommand (int nuta, int typ);

0

Dziękuje bardzo ale został jeszcze error

In function 'int SendCommand(int, int)':
[Error] 'OutPort' was not declared in this scope

Nie będę przecież ładował w każdym użyciu tej biblioteki :)

1

OutPort - zrobiłeś jako zmienną lokalną.
Przekaż ją do SendCommand lub zrób globalną a jeszcze lepiej jako statyczną w SendCommand

1 użytkowników online, w tym zalogowanych: 0, gości: 1