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,push_back’ in
char**)': main.cpp:46: error: request
for memberstring1',std::vector > ()()’
which is of non
-class type
I tried this with a vector of ints and strings as well and they had the same problem.
Don’t use parentheses to invoke the default constructor:
Otherwise this declares a function
string1that takes no argumentes and returns avector<char>.