seaza Posted March 2, 2012 Report Posted March 2, 2012 (edited) am urmatoarea eroare la build solution: error LNK2019: unresolved external symbol "public: class multime __thiscall multime::operator+(class multime &)" (??Hmultime@@QAE?AV0@AAV0@@Z) referenced in function _maincodul este://se genereaza doua multimi si se afiseaza reuniunea lor#include<iostream>#include "incapsulare_multimi.cpp"using namespace std;int main(){ multime m, m1, m2; int i; m=m+15; m=m+7; m=m+23; m=17+m; m=m+799; m1=m1+11; m1=7+m1; m1=0+m1; m1=1+m1; m=m+m1; for(i=0; i<800; i++) if(m.in(i)) cout<<i<<" "; system("PAUSE"); return 0;}"incapsulare_multimi.cpp"class multime{ char mult[100];public: int i; multime(); int in(int n); multime operator+(multime& m); multime operator-(multime& m); multime operator*(multime& m); friend multime operator+(multime& m, int n); friend multime operator+(int n, multime& m);};multime::multime(){ for(i=0; i<100; i++) mult[i]=0;}int multime::in(int n){ unsigned char nr_bit=7-n%8, masca=1; int nr_octet=n/8; masca=masca<<nr_bit; if(mult[nr_octet] && masca) return 1; else return 0;}multime operator+(multime& m, int n){ multime m1=m; unsigned char nr_bit=7-n%8, masca=1; int nr_octet=n/8; masca=masca<<nr_bit; m1.mult[nr_octet]=m1.mult[nr_octet]|masca; return m1;}multime operator+(int n, multime& m){ multime m1=m; unsigned char nr_bit=7-n%8, masca=1; int nr_octet=n/8; masca=masca<<nr_bit; m1.mult[nr_octet]=m1.mult[nr_octet]|masca; return m1;}multime multime::operator-(multime& m){ multime m1; int i; for(i=0; i<100; i++) m1.mult[i]=m1.mult[i]& (mult[i]^m.mult[i]); return m1;}multime multime::operator*(multime& m){ multime m1; int i; for(i=0; i<100; i++) m1.mult[i]=mult[i] & m.mult[i]; return m1;}any ideas? Edited March 2, 2012 by seaza Quote
nedo Posted March 2, 2012 Report Posted March 2, 2012 Pentru ambele definitii ale operatorului + ai uitat sa pui inainte multimetu ai definit doar multime operator+(argumente)trebuia multime multime::operator+(argumente) Quote
seaza Posted March 2, 2012 Author Report Posted March 2, 2012 dap...multime multime:: operator+(multime& m){multime m1;int i;for(i=1; i<100; i++)m1.mult=mult | m.mult;return m1;}thks:D Quote