In main.cpp
#include <iostream>
#include "init.h"
using namespace std;
Initialization Init;
int main() {
Init.test();
return 0;
}
In init.cpp
#include <iostream>
using namespace std;
class Initialization
{
public:
void test()
{
for(int i=0; i<10; i++)
{
cout<<i;
}
}
};
In init.h
#ifndef INIT_H_
#define INIT_H_
class Initialization
{
public:
void test();
};
#endif /* INIT_H_ */
Error is undefined reference to `Initialization::test()'
I can't figure out the problem. I just wanna test prototype a class and declare the class in main function.