473,672 Members | 2,826 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is it a bug in gcc2.3.2?

the following code cannot pass the compiler:

#include <fstream>
#include <iostream>

using namespace std;

int main()
{
fstream outfile("i:\\te st.txt", ios_base::in | ios_base::out);
long lFlag = outfile.flags() ;

outfile.setf(io s_base::app);
cout << hex << "Original flag : " << lFlag << '\n'
<< "Now flag : " << outfile.flags() << '\n';

if (outfile.flags( ) & ios_base::app)
cout << "append bit set!\n";

char ch;
while (cin >> ch)
outfile << ch;

cout << '\n';
outfile.seekg(0 );
while (outfile.get(ch ))
cout << ch;
cout << '\n';

return 0;
}

the compiler returns the errors:

test3.cpp: In function `int main()':
test3.cpp:11: no matching function for call to
`std::basic_fst ream<char,
std::char_trait s<char> >::setf(const std::_Ios_Openm ode&)'
i:/mingw/include/c++/3.2/bits/ios_base.h:342: candidates are:
std::_Ios_Fmtfl ags std::ios_base:: setf(std::_Ios_ Fmtflags)
i:/mingw/include/c++/3.2/bits/ios_base.h:350:
std::_Ios_Fmtfl ags std::ios_base:: setf(std::_Ios_ Fmtflags,
std::_Ios_Fmtfl ags)

but there is no problem with both bcc5.5 and vc6.0.

my system is Windows2000 and i use the gcc2.3.2 shipped with
mingw2.0.3.

what's the matter with gcc2.3.2 or my program?
Jul 19 '05 #1
1 1883

"gukn9700" <gu******@hotma il.com> wrote in message
news:5g******** *************** *********@4ax.c om...
the following code cannot pass the compiler:

#include <fstream>
#include <iostream>

using namespace std;

int main()
{
fstream outfile("i:\\te st.txt", ios_base::in | ios_base::out);
long lFlag = outfile.flags() ;

outfile.setf(io s_base::app);
cout << hex << "Original flag : " << lFlag << '\n'
<< "Now flag : " << outfile.flags() << '\n';

if (outfile.flags( ) & ios_base::app)
cout << "append bit set!\n";

char ch;
while (cin >> ch)
outfile << ch;

cout << '\n';
outfile.seekg(0 );
while (outfile.get(ch ))
cout << ch;
cout << '\n';

return 0;
}

the compiler returns the errors:

test3.cpp: In function `int main()':
test3.cpp:11: no matching function for call to
`std::basic_fst ream<char,
std::char_trait s<char> >::setf(const std::_Ios_Openm ode&)'
i:/mingw/include/c++/3.2/bits/ios_base.h:342: candidates are:
std::_Ios_Fmtfl ags std::ios_base:: setf(std::_Ios_ Fmtflags)
i:/mingw/include/c++/3.2/bits/ios_base.h:350:
std::_Ios_Fmtfl ags std::ios_base:: setf(std::_Ios_ Fmtflags,
std::_Ios_Fmtfl ags)

but there is no problem with both bcc5.5 and vc6.0.

my system is Windows2000 and i use the gcc2.3.2 shipped with
mingw2.0.3.

what's the matter with gcc2.3.2 or my program?


Your program of course. setf is for format flags, ios_base::app is an open
mode flag. Probably those other compilers defined format flags and open mode
flags as both being type long, so they could not detect this error. gcc is
superior (in this respect at least).

john
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2746
by: Slavik | last post by:
All libraries were installed (precompiled) This is FreeBSD 5.1 installed zlib, installed jpeg and png libraries (in default directories) GD 2.0.11 source is in /usr/gd-2.0.11 (compiled and installed flawlesly) I configured PHP with the following: ../configure --with-gd=/usr/gd-2.0.11 --with-freetype-dir=/usr --enable-g d-native-ttf --enable-gd-imgstrttf --with-jpeg-dir=/usr --enable-png-
0
1325
by: Erik | last post by:
I try to participate in the translation of the PHP manual and want to install Jade. That one goes wrong: The configure of jade goes wrong. here is the tail of config.log and the tail of the make. I use RH9 =========================================
0
1775
by: Aliencat | last post by:
I'm having issues compiling php v4.2.2 on Redhat 9.0. The goal ultimately is to compile in mcrypt support, but that's a bit down the road from here. I've chased down the dependencies for the configure options below (I think), but it still won't configure. It appears to be choking on MySql (v3.23.54). The error I get is something like: /usr/bin/ld : cannot find -lmysqlclient
0
2708
by: Ville Mattila | last post by:
Hello readers, I'm trying to install the latest PHP4 version from the scratch. The configure string is following: ../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-curl --enable-exif --enable-mbsting=all --with-gd --with-openssl --with-zlib-dir=/usr --with-zlib Everything goes well until the cURL should be configured. At that point, I will encounter an error like this:
5
1545
by: Philip Goisman | last post by:
Hi, Hope someone can help. I have the following c++ program which compiles fine in gcc2.96, but won't compile in gcc3.2.2: //FMain.cpp #include <stdlib.h> #include <stdio.h> #include <iostream>
3
8662
by: Georg | last post by:
Hello, I must be doing something wrong, but I don't get it: - compile gcc -c -O -Iinc src/hello.c -o obj/hello.o gcc -c -O -Iinc src/msg_1.c -o obj/msg_1.o gcc -c -O -Iinc src/msg_2.c -o obj/msg_2.o - make library
5
3064
by: Jagadish Kumar, Maripi | last post by:
Hi, I got the following error while trying to compile php with mysql. I would be glad if anyone can help me on this. Here is the error that i've got in config.log The command i used is: ../configure --prefix=/opt1/php.5.2.1 --with-oci8=instantclient,/opt1/oracle_instantclient_10_2 \ --with-apxs2=/spare/WWW2/bin/apxs --enable-sigchild --with-libxml-dir=/opt1/xml2
0
1071
by: Jloyd | last post by:
Hi all, I wanted to install the cross compiler for m68k (motorola) GCC2.96+ or GCC 4.2 Beta version in cygwin. This compiler is used to compile the C source code. I got to know that the GCC 2.96+ compiler is from Windriver and that Tornado is required to be installed. I have the header files of Tornado but it is not installed ...Is tornado required to be installed?? Please send me the installation procedure and the build sequence to...
0
927
by: nano2 | last post by:
Hi all, I am trying to link in shared objects but when i do I get undefined symbols with my LDFLAGS += -L $(PLATFORM_LIBS) I am can overcome this by using -shared however I don't want a shared object Does anyone know what flag i can use so that I don't get undefined symbols with the GNU ld version 2.15.92.0.2 Thanks
0
8419
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8945
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8844
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7472
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4239
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2836
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2092
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.