Código:
y nose porque me salta.undefined reference to `MiClase::MiClase(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
Tengo estos 3 archivos.
main.cpp
Código:
MiClase.hint main()
{
string algo="hola";
MiClase miClase(algo);
cout << miClase.mostrarTexto() << endl;
miClase.asignarTexto("adios");
cout << miClase.mostrarTexto() << endl;
return 0;
}
Código:
MiClase.cpp#ifndef MICLASE_H_INCLUDED
#define MICLASE_H_INCLUDED
#include <string>
using namespace std;
class MiClase
{
private:
string texto;
public:
MiClase(string algo);
void asignarTexto(string txt);
string mostrarTexto() const;
};
#endif // MICLASE_H_INCLUDED
Código:
Que estoy haciendo mal?? #include "MiClase.h"
MiClase::MiClase(string algo):
texto(algo)
{
cout << texto << endl;
}
void MiClase::asignarTexto(string txt)
{
texto=txt;
}
string MiClase::mostrarTexto() const
{
cout << texto << endl;
return texto;
}


