C++ 命名空间问题

fly871117 fly871117 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在VS2005中,添加一个类库项目 f0122,代码是

// f0122.h

#pragma once
#include "stdafx.h"
using namespace System;
using namespace std;

namespace f0122 {

class myTestClass{
int _id ;
string _name;
public:
myTestClass(int id,string str);

~myTestClass(){}

int getId();
string getName();

void setId(int id);
void setName(string name);
};
}

另外在新建一个Win32控制台应用程序,想在控制台应用程序里调用新建类库的类

#include <iostream>
#include <string>
#include <Windows.h>
using namespace std;
using namespace f0122;

但是在引用命名空间时出错(既上面代码第五行出错),请问怎么解决?

PS:我在Win32控制台应用程序已经添加了对f0122的引用。

...全文
评论 31
收藏 已收藏
分享
返回顶部
fly871117
C++ 语言 65,214 成员 250,514 内容