LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 08-18-2003, 06:17 PM   #1
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..

const bool Fleet::Save( FILE *fd )
        fprintf( fd ,
                      "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)

Old 08-18-2003, 07:32 PM   #2
Registered: Jul 2003
Distribution: Slackware
Posts: 389

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
int fprintf(FILE *stream, const char *format, ...);
You're trying to pass a string through the "..." there.

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



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 09:41 PM
Wierd Error message showin up dizzydauno Linux - General 11 07-20-2004 06:57 PM
wierd error xdopex Linux - Newbie 1 04-24-2004 10:41 AM
wierd error messages in konsole lostlyre Linux - Software 1 04-01-2004 04:12 PM
wierd gdb error teval Programming 13 08-22-2003 12:15 AM

All times are GMT -5. The time now is 01:59 AM.

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