I write a program in c++ with two files.
main.cpp
#include "var.hpp"
#include <iostream>
using namespace std;
using namespace YU;
int main()
{
string god = "THL";
age = 10;
cout << age << endl;
cout << god << endl;
return 0;
}
var.hpp
#ifndef __VAR_H__
#define __VAR_H__
#include <string>
namespace YU
{
int age;
string name;
}
#endif
When I compilered it, It'get wrong.
the wrong infomation is:
In file included from main.cpp:1:0:
var.hpp:9:5: Error: ‘string’ is not a type name
I don't know why,I had include <string> head file, but it still dosen't work.
I write this code just for practice, not for work.
thank you!