Article View: att.lang.c++
Article #150Re: Help: problems using cin and cout
From: Jim Gewin
Date: Thu, 21 Jan 1999 00:00
Date: Thu, 21 Jan 1999 00:00
54 lines
2649 bytes
2649 bytes
Here's a guess: Since cout and cin are namespace scoped objects, they have to be initialized before being used. I'll bet the compiler depends on some C++ run-time code being linked in and executed before main, but Cobol doesn't know this, and so they are never constructed. Srinivas Junnuru wrote: > > Thanks for the reply. > > The situation is: A main Cobol85 program calls a C++ function (say CPPFUNC). > What all CPPFUNC has is two cout and one cin statements. > When I link and run the cobol program, I can see that it first gets into the > cobol program (as I have some display statements in it) and then it goes > into CPPFUNC.. As soon as it hits the cout and cin statements I get a > segmentation violation... There is nothing fancy in this CPPFUNC... Now, if > I replace the cin and cout with scanf and printf statements, the program > works great!!! So, what am I missing here??? > > FYI, I am working on HP-UX, using HP aCC and Cobol85 compilers. > > Thanks in advance. > > -Srini > > -- > > (Srinivas Junnuru) > Note: Pl. remove NOSPAM from my address to e-mail me. > > Martijn Lievaart wrote in message <78502s$7ue@news3.euro.net>... > >Srinivas Junnuru wrote in message <784487$cvu$1@news.mr.net>... > >> Can some one tell me what are all the libraries needed for using cin and > >> cout?? I am getting segmentation violation at run time if I use cin and > >> cout.. Also, what are all the libraries available for streaming?? > >> > > > > > >If your program links, you have all libraries correct. If it crashes at > >runtime, you made an error in your program. I have a good guess what it is, > >but I'll have to see your source code first to know for sure. > > > >I'm not sure what you mean by "all the libraries available for streaming". > > > >HTH, > >Martijn > >-- > >My reply-to address is intentionally set to /dev/null > >reply to mlievaart at orion in nl > > > > > > > >
Technical Details
Message-ID:
<36A67A63.34EA0693@worldnet.att.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<784487$cvu$1@news.mr.net> <78502s$7ue@news3.euro.net> <784eea$efn$1@news.mr.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4ba,cbc70b249c29f52f X-Google-Attributes: gid10d4ba,public X-Google-Thread: 109fba,cbc70b249c29f52f X-Google-Attributes: gid109fba,public From: Jim Gewin <jgewin@worldnet.att.net> Subject: Re: Help: problems using cin and cout Date: 1999/01/21 Message-ID: <36A67A63.34EA0693@worldnet.att.net> X-Deja-AN: 435038081 Content-Transfer-Encoding: 7bit References: <784487$cvu$1@news.mr.net> <78502s$7ue@news3.euro.net> <784eea$efn$1@news.mr.net> Content-Type: text/plain; charset=us-ascii Organization: AT&T WorldNet Services Mime-Version: 1.0 Reply-To: jgewin@worldnet.att.net Newsgroups: att.lang.c++,comp.lang.c++