c++ vector.push_back error: request for member 'push_back'..., which is of non-class type 'vector(ch
- by Ziplin
I'm using Cygwin with GCC, and ultimately I want to read in a file of characters into a vector of characters, and using this code
#include <fstream>
#include <vector>
#include <stdlib.h>
using namespace std;
int main (int argc, char *argv[] )
{
vector<char> string1();
string1.push_back('a');
return 0;
}
generates this compile time error:
main.cpp: In function int main(int,
char**)': main.cpp:46: error: request
for memberpush_back' in string1',
which is of non
-class typestd::vector ()()'
I tried this with a vector of ints and strings as well and they had the same problem.