Tuesday, April 24, 2012

"string is not a type" in namespace

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;
}

No comments:

Post a Comment