I was wondering if anyone could help me out with this - I'm only new to C++ and it's causing me a fair amount of troubles. I'm trying to replicate a tutorial this is my test.cpp file
#include <iostream>
#include "cat.h"
using namespace std;
int main()
{
speak();
}
this is my header file "Cat.h"
#ifndef CAT_H_INCLUDED
#define CAT_H_INCLUDED
void speak();
#endif // CAT_H_INCLUDED
this is my function declaration file Cat.cpp
#include <iostream>
#include "Cat.h"
using namespace std;
void speak()
{
cout << "meowwww" << endl;
}
But when I update my test.cpp file like this its working but in the original tutorial the tutor didn't add the source file in the test file
#include <iostream>
#include "Cat.h"
#include "Cat.cpp"
using namespace std;
int main()
{
Cat cat1;
cat1.speak();
return 0;
}