delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/02/14/17:45:40

From: "J. L." <jlsgarrido AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: open() in c++
Date: Fri, 14 Feb 2003 16:36:10 -0600
Lines: 64
Message-ID: <b2jr0v$1d4dij$1@ID-143309.news.dfncis.de>
References: <200302140432 DOT h1E4WcuJ018929 AT chac DOT its DOT uow DOT edu DOT au>
NNTP-Posting-Host: 200.34.143.29
X-Trace: fu-berlin.de 1045262177 47330899 200.34.143.29 (16 [143309])
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Y Chen" <yc12 AT uow DOT edu DOT au> escribió en el mensaje
news:200302140432 DOT h1E4WcuJ018929 AT chac DOT its DOT uow DOT edu DOT au...
> Dear Sir,
>
> I've changed
>   char TIOBase::OpenFile(char* acFilename, int aiMode)
> to
>   char TIOBase::OpenFile(char* acFilename, std::_Ios_Openmode aiMode)
> to avoid the error:
>   IOBase.cpp:45: no matching function for call to
`std::basic_fstream<char,
>    std::char_traits<char> >::open(char[101], int&)'
>
>
>
> But the following sentence:
>   if (OpenFile(cParFilename, ios::in)) return 1;
>
> gives the following error during link:
>
> LSTM2.o(.text+0x11f6):LSTM2.cpp: more undefined references to
`TIOBase::OpenFile
> (char*, int)' follow
>
> How to modify ios::in to get rid of the link error?
> Thanks a lot for your help.
>
> Regards,
> Y Chen
>

[snip code]

Are you kidding? Your code it's a horrible mess of C and C++, and you have a
strange mix of old and new header files.

In another thread, I ask for the version of GCC/DJGPP and the name of book
or tutorial that you're using. Because the first #include in your source is

#include <iostream>

my guess it's that GCC > 3.0 (or that you misunderstood previous advices).

Can you explain me why do you use the old (deprecated) form for the headers
iomanip and string?

Many times, you're advised for the RIGHT WAY include headers in C++, and,
most importantly, that you provide a *short* piece of compilable code. Did
you expect that we follow hundreds of lines of code?

Seriously, you need a better tutorial/book. I recommend _Thinking in C++,
2nd Edition, by Bruce Eckel. You can download at

http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

OTOH, after your code was edited (according Standard), its compilable, but
you forgot list the LSTM2.cpp file :(

HTH

J. L.


- Raw text -


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