delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/22/08:02:46

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Reply-To: <nhv AT cape DOT com>
From: "Norman Vine" <nhv AT cape DOT com>
To: "'Dan Mergens'" <dan AT photon DOT com>, <cygwin AT cygwin DOT com>
Subject: RE: vector
Date: Thu, 22 Aug 2002 08:07:42 -0400
Message-ID: <03bd01c249d4$859f4fe0$a300a8c0@nhv>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
In-Reply-To: <3D649A95.3503A7BF@photon.com>
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Importance: Normal
X-Virus-Scanned: Cape.Com VirusScan, no known virus found

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019