I normally program in c++ on linux, but recently I have begun learning game hacking so I have started creating my programs in visual studio. I'm relatively new to c++ having only started learning it this semester in school. I keep getting: "Hello is not a class or namespace name." I tied taking a working program from my linux vm and using it in Visual Studio and still got the same errors.
my code is as follows:
#pragma once
#ifndef HELLO_H
#define HELLO_H
#include "stdafx.h"
#include <Windows.h>
#include <string>
#include <iostream>
class Hello {
public:
Hello();
void setString(std::string w);
void print();
private:
std::string word;
};
#endif // !1
#include "Hello.h"
#include "stdafx.h"
Hello::Hello() {
word = "hello world";
}
void Hello::setString(std::string w) {
word = w;
}
void Hello::print() {
std::cout << word << std::endl;
}
// HelloWorld.cpp : Defines the entry point for the console application.
//
#include "Hello.h"
#include "stdafx.h"
int main()
{
Hello* word = new Hello();
word->print();
word->setString("test");
word->print();
system("pause");
return 0;
}