This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
RE: vector
- From: "Norman Vine" <nhv at cape dot com>
- To: "'Dan Mergens'" <dan at photon dot com>, <cygwin at cygwin dot com>
- Date: Thu, 22 Aug 2002 08:07:42 -0400
- Subject: RE: vector
- Reply-to: <nhv at cape dot com>
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/