//.h文件
#pragma once
#include <iostream>
using namespace std;
namespace test1 {
int make;
void func();
}
namespace test2 {
void func();
}
//test.cpp文件
#include <iostream>
#include "test.h"
void test1::func()
{
std::cout << "func" << std::endl;
}
命名空间.cpp文件
#include<iostream>
#include"test.h"
using namespace std;
//2.
namespace A {
int a;
namespace B {
int b;
}
}
//3.
namespace A {
int c;
}
//5.
void test()
{
namespace C = A;
}
int a;
int main()
{
int a;
test1::func(); //6.
return 0;
}
若我要在命名空间.cpp文件中使用.h文件中的make时,错误提示是test1命名空间中不包含make,但是我在定义make后编译时,也没有提示重定义的问题?