Jump to content
seaza

eroare la build

Recommended Posts

Posted (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 _main

codul 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?:-S

Edited by seaza
Posted

Pentru ambele definitii ale operatorului + ai uitat sa pui inainte multime

tu ai definit doar

multime operator+(argumente)

trebuia

multime multime::operator+(argumente)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...