Re: 'vector' was not declared in this scope

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ales88 <alessandro-panzeri@xxxxxxxx> writes:

> THE ERROR HAPPENS BOTH WITH STD:: AND WITHOUT.

No need to shout.  We're trying to help.

You have to show us the exact code you are compiling, and the exact
error message you get.

When I compile this code:

#include <vector>
#include <sys/types.h>
#include <netinet/in.h>
#include <vector>

int main() {

int i=1;

typedef struct {

float etx, pf, pr;
struct in_addr addr;

}neigh;

 std::vector<neigh>neigh_list;
}


I get this error with gcc 4.4.3:

foo.cc: In function âint main()â:
foo.cc:17: error: template argument for âtemplate<class _Tp> class std::allocatorâ uses local type âmain()::neighâ
foo.cc:17: error:   trying to instantiate âtemplate<class _Tp> class std::allocatorâ
foo.cc:17: error: template argument 2 is invalid
foo.cc:17: error: invalid type in declaration before â;â token


I get this error with current gcc mainline:

foo.cc: In function âint main()â:
foo.cc:17:19: error: template argument for âtemplate<class _Tp> class std::allocatorâ uses local type âmain()::neighâ
foo.cc:17:19: error:   trying to instantiate âtemplate<class _Tp> class std::allocatorâ
foo.cc:17:19: error: template argument 2 is invalid
foo.cc:17:30: error: invalid type in declaration before â;â token


What error do you get?

Ian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux