Jeg har fulgt dine råd, og det giver flere fejl, jeg ikke forstår. Her er hele loggen:
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(18) : error C2148: total size of array must not exceed 0x7fffffff bytes
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(18) : error C2079: 'Sensor::nySensor' uses undefined class 'Sensor'
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(35) : error C2512: 'Sensor' : no appropriate default constructor available
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(62) : error C2582: 'operator =' function is unavailable in 'Sensor'
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(73) : error C2059: syntax error : '*'
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(74) : error C2511: 'void Sensor::sendMsg(int *)' : overloaded member function not found in 'Sensor'
1> c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(10) : see declaration of 'Sensor'
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(144) : error C2660: 'Sensor::sendMsg' : function does not take 2 arguments
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(167) : error C2660: 'Sensor::sendMsg' : function does not take 3 arguments
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(183) : error C2065: 'signal' : undeclared identifier
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(186) : error C2065: 'sensor' : undeclared identifier
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(186) : error C2228: left of '.antal' must have class/struct/union
1> type is ''unknown-type''
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(201) : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'overloaded-function' (or there is no acceptable conversion)
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(1144): could be 'std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char *)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(1146): or 'std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(1148): or 'std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,unsigned char *)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(1150): or 'std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,unsigned char &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(155): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_istream<_Elem,_Traits> &(__cdecl *)(std::basic_istream<_Elem,_Traits> &))'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(161): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_ios<_Elem,_Traits> &(__cdecl *)(std::basic_ios<_Elem,_Traits> &))'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(168): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::ios_base &(__cdecl *)(std::ios_base &))'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(175): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::_Bool &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(194): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(short &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(228): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned short &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(247): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(int &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(273): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned int &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(291): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(long &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(309): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(__w64 unsigned long &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(329): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(__int64 &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(348): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned __int64 &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(367): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(float &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(386): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(double &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(404): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(long double &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(422): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(void *&)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\programmer\microsoft visual studio 9.0\vc\include\istream(441): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_streambuf<_Elem,_Traits> *)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> while trying to match the argument list '(std::basic_istream<_Elem,_Traits>, overloaded-function)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(204) : error C2065: 'signal' : undeclared identifier
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(211) : error C2065: 'navn' : undeclared identifier
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(217) : error C2065: 'navn' : undeclared identifier
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(233) : error C2562: 'main' : 'void' function returning a value
1> c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(231) : see declaration of 'main'
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(237) : error C3861: 'reg_sensor': identifier not found
1>c:\documents and settings\eucvest\dokumenter\my dropbox\htx\teknologi\isb_program\isbfinal\isbfinal\alarm.cpp(240) : error C3861: 'alarm': identifier not found
1>Build log was saved at "file://c:\Documents and Settings\EUCVEST\Dokumenter\My Dropbox\HTX\teknologi\ISB_PROGRAM\ISBFINAL\ISBFINAL\Debug\BuildLog.htm"
1>ISBFINAL - 18 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I bedte også om mere kode, så poster lige klassen og funktionen, der skal oprette objekterne:
class Sensor
{
public:
Sensor(char *, char *, int, bool, int, int, int);
void vis_sensor(void);//viser sensorens oplysninger
void reg_sensor(void);//registrer ny sensor
void sendMsg(int);//sender besked til brugeren + sørger for at logge hvad der er sket med dato og tid.
void alarm(void);//det kunstige intelligens i programmet
int antal;//antal sensorer computeren er har registeret og tilsluttet
Sensor nySensor[30];
private:
char navn[64];//sensorens navn TOMMY HJÆLP MED AT ÆNDRE DET TIL navn[64]
char rum[64];//rummet sensoren befinder sig i
int vigtig;//bruges til at tjekke hvor vigtig brugeren har valgt at sensoren skal være
bool aktiv;//Bruges til at tjekke om sensoren allerede har opdaget noget(alarm funktionen
int normal;//normal værdi for denne sensor
int vaerdi;//ændring i værdi=igangsætning af alarm
int vigtigMedium;//bruges i alarm
int vigtigSmall;//Bruges i alarm
int antalSensor;//Bruges i alarm
int signal; //sensors signal, hvis 0 ingen sensor tilsluttet.
int backup[2];//tager backup af de 3 variabler, så de kan "resettes" efter de har været brugt en gang
};
void Sensor::reg_sensor(void)
{
if(signal=1)
{
antal++;
int i=antal;
cout << "Ny sensor blev registreret" << endl;
cout << "Udfyld venligst informationerne herunder: " << endl;
cout << "Hvad vil du kalde den nye sensor?" << endl;
cin >> navn;
cout << "Godt navn. Hvor vigtig synes du sensoren skal være, på en skala fra 1-10?" << endl;
cin >> vigtig;
cout << "Godt valg. Hvilket rum befinder sensoreren sig i?" << endl;
cin >> rum;
Sensor s(navn, rum, vigtig, aktiv, normal, vaerdi, signal);
nySensor[i]=s;
nySensor[i].vis_sensor();
}
}