LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-18-2003, 05:17 PM   #1
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
Wierd POD type error


../Source/Game/Fleet.cpp: In member function `const bool Fleet::Save(FILE*)':
../Source/Game/Fleet.cpp:82: warning: cannot pass objects of non-POD type `
const struct std::string' through `...'; call will abort at runtime

I have no clue what a POD type struct is or a `...' call.
I'm asumming the ... call is the %-substitution in printf()
I might be wrong..

Code:
const bool Fleet::Save( FILE *fd )
{
        fprintf( fd ,
                                "\n[%s-Fleet_%s]\n"
                      "posx = %f\n"
                                "posy = %f\n"
                                "origin = %s\n"
                      "destx = %f\n"
                                "desty = %f\n"
        , species.c_str() , name.c_str() , position.x , position.y , origin.c_str() , dest.x , dest.y );
        if( !destination.empty() )
                fprintf( fd , "destination = %s\n" , destination.c_str() );

        int     i = 0;
        for( vector<Vessel *>::iterator it = begin() ; it != end() ; ++it )
                for( int j = 0 ; j < (*it)->GetCount() ; j++ )
                        fprintf( fd , "%d = %s\n" , i++ , (*it)->vesselClass ); //LINE 82 with the error

        return true;
}
Any clue what's happining?
I can provide any part of the code..and if you want you can get it from sourceforge.. Borqueror is GPLed (I'm porting it back to Linux, even though it's supposed to work)

Thanks
 
Old 08-18-2003, 06:32 PM   #2
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 388

Rep: Reputation: 52
POD stands for Plain Old Data. A POD type is a type that makes no use of special C++ features (features beyond C features). For example, a class is not a POD type because it can use inheritance, virtual functions, etc. An example of a POD type is int.

The signature for fprintf is
Code:
int fprintf(FILE *stream, const char *format, ...);
You're trying to pass a string through the "..." there.

You could try changing line 82 to
Code:
fprintf( fd , "%d = %s\n" , i++ , (*it)->vesselClass.c_str());
It seemed to work on the line above.

Lyle
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd Qt error on slackware 10 sganarelle Slackware 11 08-17-2004 08:41 PM
Wierd Error message showin up dizzydauno Linux - General 11 07-20-2004 05:57 PM
wierd error xdopex Linux - Newbie 1 04-24-2004 09:41 AM
wierd error messages in konsole lostlyre Linux - Software 1 04-01-2004 03:12 PM
wierd gdb error teval Programming 13 08-21-2003 11:15 PM


All times are GMT -5. The time now is 01:51 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration