Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22137

c++ vector.push_back error: request for member 'push_back'..., which is of non-class type 'vector(char, allocator(char)) ()()'

$
0
0

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.


Viewing all articles
Browse latest Browse all 22137

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>