ghostbody / 15-cpp-learning

15 c++ learning repository of SDCS SYSU
6 stars 3 forks source link

totally confused #8

Open mgsweet opened 8 years ago

mgsweet commented 8 years ago

bitset那题,为什么xcode完全编译不了,之前也出现过类似的状况,忘了是打vector还是matrix,好像和它本身定义的东西有冲突,放上eden完美编译

2016-04-16 9 21 17

求ta赐教

ghostbody commented 8 years ago

I do not have apple laptop and I do not know what the xcode happen. I used clang++ in linux to compile the standard answer code and no error reported. Please make sure you are using the correct template argument in declaration.

DaddyTrap commented 8 years ago

@mgsweet I think it is

using namespace std;

that results in this problem.

There is a class named bitset in C++'s standard library. Though you haven't included that library, your IDE may do that I think.

When using using namespace std; , just replace it by using std::cout; or etc. Maybe it helps, maybe it doesn't........Please try it yourself and hope it works.

mgsweet commented 8 years ago

@DaddyTrap @ghostbody Thank you very much, i will try it later 👍

ghostbody commented 8 years ago

@DaddyTrap @mgsweet Well, using namespace std is a dangerous statement. Do not add a whole namespace into current context, you never know what's inside std.

mgsweet commented 8 years ago

@ghostbody @DaddyTrap Thanks you very much. It is the 'using namespace' in main.h that cause the problem. I change it with using std::cout; using std::can; And it works. Obviously, @DaddyTrap you are right.