//this is test_namespace_1.hpp#pragmaonce#include<iostream>namespace namespace_1 {voidfunc(){
std::cout <<"namespace_1"<< std::endl;}}
//this is test_namespace_2.hpp#pragmaonce#include<iostream>namespace namespace_1 {voidfunc(){
std::cout <<"namespace_2"<< std::endl;}}
//main.cpp#include"test_namespace_1.hpp"#include"test_namespace_2.hpp"intmain(){
namespace_1::func();//namespace_2::func();//func();// func is undefinedreturn0;}
会看到如下报错:
回家不想写代码,不想写文章,于是买了把新键盘,果然有效果。。。花了钱就是认真了不少。xdm,晚安
“Every child eventually comes to a bridge that they must cross alone.”—网易词典每日一句