Witam,
mam taki mały kod:
main
#include <iostream>
#include "niam.h"
using namespace std;
int main()
{
a* abc = new a("asd");
return 0;
}
niam.h
#ifndef NIAM_H_INCLUDED
#define NIAM_H_INCLUDED
#include <string>
#include <iostream>
class a
{
public:
a(std::string str);
};
#endif // NIAM_H_INCLUDED
niam
#include "niam.h"
a::a(std::string str)
{
cout<<str.c_str;
}
Napisałem go na podstawie tego tutorialu:http://pl.wikibooks.org/wiki/C++/Konstruktor_i_destruktor
Lecz niestety pojawia się następujący błąd w build log:
...\main.cpp|7|undefined reference to
a::a(std::string)'|`
Więc o co robię źle?
Zapewne zrobiłem jakiś głupi błąd w kodzie, lecz każdy od czegoś zaczynał i proszę o wyrozumiałość. :]