因为在搞darknet_ros, 在yoloobjectdetect里面创建发布者,消息发不出去,猜测是句柄出了问题
所以试一下在命名空间里的变量怎么传递的
#include <bits/stdc++.h>
using namespace std;
namespace A{
int a = 10;
int c = 20;
void bb(){
cout<<"new c is :"<<c<<endl;
}
void kk(int d){
cout<<"hello world namespace"<<endl;
c = d;
bb();
}
}
int main()
{
cout<<"c is : "<<A::c<<endl;
cout<<"a is : "<<A::a<<endl;
A::kk(30);
cout<<"c is : "<<A::c<<endl;
return 0;
}
结果如图,原来是可以传变量的。