Line of fail: Xplano.ubicacion(Eureca.getCoordenadaX(),Eureca.getCoordenadaY()) 在main.cpp中的位置,down但大部分信息在源代码中。
谢谢。
错误:* 检测到 glibc./main:双重释放或损坏(fasttop):0x08857008 * * ======= 回溯:=========/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] ======= 内存映射:======== 08048000-0804a000 r-xp 00000000 08:05 165215 /home/administrator/Taller/main 0804A000-0804B000 RW-P 00001000 08:05 165215/HOME/ADMINDANDARE/TALLER/MAIN/MAIN 08857000-08878000 RW-P 00000000000000000000000000000000000000000000来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.736/cmov/c00-0-2 bso76. --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 0001b4400 08:08
-linux /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 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 [堆栈] 中止
主.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;
}
普莱诺.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);}
普莱诺.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