The code can do the talking.
main.cpp
#include "test.h"
#include <iostream>
#include <string>
#define NL "\n" //"NL" = "New Line"(move the pointer to the next line)
#define SL "\n\n" //"SL" = "Skip Line"(move the pointer 2 lines)
int main()
{
Cool_Object.cool_function();
return 0;
}
test.h
#ifndef TEST_H
#define TEST_H
class Cool_Class
{
public:
void cool_function();
};
#endif
test.cpp
#include "test.h"
#include <iostream>
#include <string>
#define NL "\n" //"NL" = "New Line"(move the pointer to the next line)
#define SL "\n\n" //"SL" = "Skip Line"(move the pointer 2 lines)
Cool_Class Cool_Object; //WHY CAN'T THIS WORK!!!
Cool_Object.cool_function()
{
std::cout << "SPRING!!!" << NL;
}
OK, so if I create the object in "main.cpp" it works, but there must be another way, right. All objects ever created cannot have all been created in the file containing "main()" can it?
The error I get is something like "Cool_Object was not declared in this scope".
So what is the problem here? Is it just Code::Blocks(I use Code::Blocks) that sucks or what? lol...