This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: vector


Dan Mergens writes:
>
>I'm baffled why this simple program produces the following errors.
>Strangly enough, if I remove the push_back call, it compiles without
>complaint.
>
>I'm running the latest version of cygwin. I'm sure I'm missing
>something...
>
>Thanks,
>Dan
>
>-------------- test.C ------------------
>#include <vector>
>void main() {
>vector<int> array;
>array.push_back(10);
>}
>----------------------------------------

This is really OT for this list but since there have been several
similar posts recently 
 < please use a general C++ programming list >

try

// compile with g++ < or c++ >
//  c++ test.C
// if compiling with gcc libstdc++ must be linked explicitly
//  gcc test.C -lstdc++

#include <vector>
int main(void) {
  std::vector<int> array;
  array.push_back(10);
  return 0;
}

note that main() MUST be declared to return an int
and that vector<> MUST be qualified

Norman


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]