Line of fail: Xplano.ubicacion(Eureca.getCoordenadaX(),Eureca.getCoordenadaY()) Location in main.cpp, down but most information in the source code.
Thanks.
Error: * glibc detected ./main: double free or corruption (fasttop): 0x08857008 ** ======= Backtrace: ========= /lib/i386-linux-gnu/i686/cmov/libc.so.6(+0x70f01)[0xb7550f01] /lib/i386-linux-gnu/i686/cmov/libc.so.6(+0x72768)[0xb7552768] /lib/i386-linux-gnu/i686/cmov/libc.so.6(cfree+0x6d)[0xb755581d] /usr/lib/i386-linux-gnu/libstdc++.so.6(ZdlPv+0x1f)[0xb76d44bf] ./main[0x8048cec] /lib/i386-linux-gnu/i686/cmov/libc.so.6(_libc_start_main+0xe6)[0xb74f6e46] ./main[0x8048941] ======= Memory map: ======== 08048000-0804a000 r-xp 00000000 08:05 165215 /home/administrator/Taller/main 0804a000-0804b000 rw-p 00001000 08:05 165215 /home/administrator/Taller/main 08857000-08878000 rw-p 00000000 00:00 0 [heap] b7300000-b7321000 rw-p 00000000 00:00 0 b7321000-b7400000 ---p 00000000 00:00 0 b74de000-b74e0000 rw-p 00000000 00:00 0 b74e0000-b763c000 r-xp 00000000 08:05 914371
/lib/i386-linux-gnu/i686/cmov/libc-2.13.so b763c000-b763d000 ---p 0015c000 08:05 914371 /lib/i386-linux-gnu/i686/cmov/libc-2.13.so b763d000-b763f000 r--p 0015c000 08:05 914371
/lib/i386-linux-gnu/i686/cmov/libc-2.13.so b763f000-b7640000 rw-p 0015e000 08:05 914371 /lib/i386-linux-gnu/i686/cmov/libc-2.13.so b7640000-b7643000 rw-p 00000000 00:00 0 b7643000-b765f000 r-xp 00000000 08:05 914451 /lib/i386-linux-gnu/libgcc_s.so.1 b765f000-b7660000 rw-p 0001b000 08:05 914451
/lib/i386-linux-gnu/libgcc_s.so.1 b7660000-b7661000 rw-p 00000000 00:00 0 b7661000-b7685000 r-xp 00000000 08:05 914379
/lib/i386-linux-gnu/i686/cmov/libm-2.13.so b7685000-b7686000 r--p 00023000 08:05 914379 /lib/i386-linux-gnu/i686/cmov/libm-2.13.so b7686000-b7687000 rw-p 00024000 08:05 914379
/lib/i386-linux-gnu/i686/cmov/libm-2.13.so b7687000-b7767000 r-xp 00000000 08:05 528279 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.17 b7767000-b776b000 r--p 000e0000 08:05 528279
/usr/lib/i386-linux-gnu/libstdc++.so.6.0.17 b776b000-b776c000 rw-p 000e4000 08:05 528279 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.17 b776c000-b7773000 rw-p 00000000 00:00 0 b7788000-b778c000 rw-p 00000000 00:00 0 b778c000-b778d000 r-xp 00000000 00:00 0
[vdso] b778d000-b77a9000 r-xp 00000000 08:05 914407
/lib/i386-linux-gnu/ld-2.13.so b77a9000-b77aa000 r--p 0001b000 08:05 914407 /lib/i386-linux-gnu/ld-2.13.so b77aa000-b77ab000 rw-p 0001c000 08:05 914407 /lib/i386-linux-gnu/ld-2.13.so bfe46000-bfe67000 rw-p 00000000 00:00 0 [stack] Aborted
Main.CPP
#include <iostream>
#include "Coordenada.cpp"
#include "plano.cpp"
#include <string>
using namespace std;
int main (){
int x;
int y;
x = y = 0;
std::cout << "Digite la Coordenada X:" << std::endl;
std::cin >> x;
std::cout << "Digite la Coordenada Y:" << std::endl;
std::cin >> y;
Coordenada Eureca;
Plano Xplano;
Eureca.setCoordenadaX(x);
Eureca.setCoordenadaY(y);
std::cout << "X es: " << Eureca.getCoordenadaX() << std::endl;
std::cout << "Y es: " << Eureca.getCoordenadaY() << std::endl;
std::cout << "Ubicado en el " << Xplano.ubicacion(Eureca.getCoordenadaX(),Eureca.getCoordenadaY()) << std::endl;
Eureca.~Coordenada();
Xplano.~Plano();
return 0;
}
Plano.CPP
#include <iostream>
#include <string>
#include "plano.hpp"
using namespace std;
using std::string;
Plano::Plano(){ubicacionX = "desconocido";}
Plano::~Plano(){}
string Plano::ubicacion(int x, int y) { if ((x=0) && (y=0)){this->ubicacionX = "origen";}
return (this->ubicacionX);}
Plano.HPP
#ifndef _PLANO_HPP
#define _PLANO_HPP
#include <string>
using std::string;
class Plano{
private:
string ubicacionX;
public:
Plano();
~Plano();
string ubicacion(int x, int y);
};
#endif