![]() |
| ||
| Why compiler complants error when compile. Anybody could tell me what's wrong with the following code? It complaints: 13 C:\apps\Dev-Cpp\projects\14\14_1.cpp ISO C++ forbids defining types within return type Thanks in advance. #include <iostream> << moderator edit: added [code][/code] tags >> |
| ||
| Re: Why compiler complants error when compile. There will be ambiguity with your class and std::vector since you are using namespace std. struct vectorIf you still want to grab the whole namespace, I think you can disambiguate like this. friend ostream& operator<< (ostream&, ::vector); |
| ||
| Re: Why compiler complants error when compile. or in full "std::vector", but there is still a danger that the struct name will cause errors. Easy just to do
then in the main just use my_vector::vector v1; instead. This solves any name problems you might have by making your own namespace |
| ||
| Re: Why compiler complants error when compile. From what I see you're missing a semicolon after the '}' from your definition of your struct. hope this helps.. |
| All times are GMT -4. The time now is 4:07 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC