473,383 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Porting old non ansi code

Hello all,

i've downloaded the source code of a GPL project but i don't manage to
compile it.

It have been written with an old g++ (<3) since there are #include <xxx.h>
and no std:: at all... In addition, all the C++ file extensions are '.C'
and '.h', makefile c++ compiler variable is "CC" with "CC-FLAGS"...

But others problems are harder to solve. For example, i have:

src/rec/Train.C: In member function `void Train::WriteTrainingFile(const
char*)':
src/rec/Train.C:272: aggregate `std::filebuf fbuff' has incomplete type and
cannot be defined

with:

272 filebuf fbuff;
273 fbuff.open( path, ios::out );
274 ostream out( &fbuff );

I don't see any problem...

Also, a g++ extension seems to be used: the "form()" function wich is used
like that:

out << form( TD_VersionFormat, TD_Version )

Do you know a macro i could define using ansi c++ so that the code can
compile?

I would like to correct the code and submit a path to these great searchers
but really poor programmers...

Thx by advance

--
TheDD
Jul 22 '05 #1
5 1921

"TheDD" <pa***@email.com> wrote in message
news:cw****************************@40tude.net...
Hello all,

i've downloaded the source code of a GPL project but i don't manage to
compile it.

It have been written with an old g++ (<3) since there are #include <xxx.h>
and no std:: at all... In addition, all the C++ file extensions are '.C'
and '.h', makefile c++ compiler variable is "CC" with "CC-FLAGS"...

But others problems are harder to solve. For example, i have:

src/rec/Train.C: In member function `void Train::WriteTrainingFile(const
char*)':
src/rec/Train.C:272: aggregate `std::filebuf fbuff' has incomplete type and cannot be defined

with:

272 filebuf fbuff;
273 fbuff.open( path, ios::out );
274 ostream out( &fbuff );

I don't see any problem...
Most likely a missing header file. Try

#include <fstream>
using namespace std;

Also, a g++ extension seems to be used: the "form()" function wich is used
like that:

out << form( TD_VersionFormat, TD_Version )

Do you know a macro i could define using ansi c++ so that the code can
compile?


Can't see why the above wouldn't compile, assuming form is defined.

john
Jul 22 '05 #2
On Mon, 23 Feb 2004 22:06:41 -0000, John Harrison wrote:
Most likely a missing header file. Try

#include <fstream>
using namespace std;
yes, it works now, thx :)
Can't see why the above wouldn't compile, assuming form is defined.


well form() doesn't seems to be defined. I believe it's an old extension of
g++ wich has been deleted. But since i don't know the STL enough, i don't
know how to emulate the form() function.

--
TheDD
Jul 22 '05 #3

"TheDD" <pa***@email.com> wrote in message
news:1x*******************************@40tude.net. ..
On Mon, 23 Feb 2004 22:06:41 -0000, John Harrison wrote:
Most likely a missing header file. Try

#include <fstream>
using namespace std;
yes, it works now, thx :)
Can't see why the above wouldn't compile, assuming form is defined.


well form() doesn't seems to be defined. I believe it's an old extension

of g++ wich has been deleted. But since i don't know the STL enough, i don't
know how to emulate the form() function.


I've never heard of it, I don't think its ever been official STL. Taking a
wild guess it might be an attempt to do printf style formatting in an
iostream context, but I would ask on a gcc group to find out for certain.

john
Jul 22 '05 #4
On Mon, 23 Feb 2004 22:30:03 -0000, John Harrison wrote:
"TheDD" <pa***@email.com> wrote in message
news:1x*******************************@40tude.net. ..
On Mon, 23 Feb 2004 22:06:41 -0000, John Harrison wrote:
Most likely a missing header file. Try

#include <fstream>
using namespace std;


yes, it works now, thx :)
Can't see why the above wouldn't compile, assuming form is defined.


well form() doesn't seems to be defined. I believe it's an old extension

of
g++ wich has been deleted. But since i don't know the STL enough, i don't
know how to emulate the form() function.


I've never heard of it, I don't think its ever been official STL. Taking a
wild guess it might be an attempt to do printf style formatting in an
iostream context, but I would ask on a gcc group to find out for certain.


it's sure:
http://www.geocrawler.com/archives/3...2/7/0/2055820/
my hack:
string form(const char *fmt, ...)
{
char tmp[2048];
va_list ap;
int res;

va_start(ap, fmt);
res = vsnprintf(tmp, 2046, fmt, ap);
va_end(ap);

return string(tmp);
}
--
David Mancel
SCIA 2005
Jul 22 '05 #5
On Mon, 23 Feb 2004 22:30:03 -0000, John Harrison wrote:
I've never heard of it, I don't think its ever been official STL. Taking a
wild guess it might be an attempt to do printf style formatting in an
iostream context, but I would ask on a gcc group to find out for certain.

john


it's sure:
http://www.geocrawler.com/archives/3...2/7/0/2055820/
my hack:
string form(const char *fmt, ...)
{
char tmp[2048];
va_list ap;
int res;

va_start(ap, fmt);
res = vsnprintf(tmp, 2046, fmt, ap);
va_end(ap);

return string(tmp);
}

--
TheDD
Jul 22 '05 #6

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

Similar topics

5
by: Ryan Liu | last post by:
Hi All, Now I am porting CC to GCC and I have some problems. Would you mind tell me some document which have some description how to port CC to GCC ?? Thank you very much. Ryan
4
by: Chris Travers | last post by:
Hi all; A few years ago, I set about porting a PHP application from MySQL to PostgreSQL, after realizing that MySQL wasn't going to be able to handle it. In order to do this, I built a light,...
6
by: Tone | last post by:
I've written a large suite of ANSI C routines for a virtual hand-held device. A hardware manufacturer with whom we wish to do business prefers C#. My understanding of C# is somewhat limited. I...
2
by: rawCoder | last post by:
Hi all, I have an application in visual basic 6 which communicates with servers written in ANSI C++ using a C++ ( non COM ) dll by passig data through functions in UDT and receiving data back...
2
by: Ted | last post by:
1) In several tables, in my MySQL version, I created columns using something like the following: `ab_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, This...
34
by: subramanian100in | last post by:
Is there any difference between porting and migrating. Kindly explain
133
by: Jean-Pierre Mestre | last post by:
Good evening, I have a C software for Windows that I need to port to Redhat Unix. At the moment it works completely fine with the Windows FLOSS compiler lccwin32. I try gcc but now it doesn't...
3
by: James Egan | last post by:
I'm porting a legacy application from HP-UX to Linux. The va_start macro takes one argument under HP-UX, but takes two under Linux: va_start under HP-UX takes only one var: hp:/home/fredgrep...
47
by: =?Utf-8?B?ZW1hdmlzdQ==?= | last post by:
Dear guys, I'm in trouble having to port my project from C++Builder6 to VisualC++. Has anyone of you idea if there are any tools to help my doing this job? My current project is widely using VCL...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.