Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-17-2006, 08:20 PM
Ronin Ronin is offline
Programming Professional
 
Join Date: Apr 2006
Posts: 299
Credits: 3
Rep Power: 11
Ronin is on a distinguished road
Default G++ Error: cannot pass objects of non-POD type

What does this error mean??

cannot pass objects of non-POD type

I'm using G++
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 10-18-2006, 06:21 AM
orbital_fox's Avatar   
orbital_fox orbital_fox is offline
Newbie
 
Join Date: Sep 2006
Posts: 26
Credits: 0
Rep Power: 9
orbital_fox is on a distinguished road
Default

POD, in C++ stands for Plain Old Data.

While u have not posted the code you have, i cannot tell your excact error, but since it says something about objects passed on and POD, i assume u are using some old data type from C, and trying to do some sort of operation that only objects in C++ can handle..
__________________
Artificial Intelligence and Robotics egnineer
http://fox.zsuatt.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-23-2006, 09:40 PM
Paradine Paradine is offline
Learning Programmer
 
Join Date: Oct 2006
Posts: 48
Credits: 0
Rep Power: 8
Paradine is on a distinguished road
Default

Can you post your code?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-19-2007, 05:11 AM
anupm anupm is offline
Newbie
 
Join Date: Sep 2007
Posts: 1
Credits: 0
Rep Power: 0
anupm is on a distinguished road
Default

i also got the same warning i will give u the code
#include<iostream>
#include<string>

using namespace std;

class CEmployee {
public:
CEmployee(string name = "No Name",
string id = "000-00-0000",
double salary = 0)
: _name(name), _id(id)
{
_salary = salary;
}
string getName() const {return _name;}
void setName(string name) {_name = name;}
string getid() const {return _id;}
void setid(string id) {_id = id;}
double getSalary() const {return _salary;}
void setSalary(double salary) {_salary = salary;}
void promote(double salary) const {_salary = salary;}
private:
string _name;
string _id;
mutable double _salary;
};

int
main()
{
CEmployee employee("Naren", "001-338-423", 23456) ;

fprintf(stderr, "--Name() Id(%s) Salary(%f)-------\n", employee.getid(), employee.getSalary()) ;

}


:!g++ %

mutable.cc: In function `int main()':
mutable.cc:34: warning: cannot pass objects of non-POD type `struct std::string' through `...'; call will abort at runtime
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-01-2007, 05:35 AM
skoe skoe is offline
Newbie
 
Join Date: Oct 2007
Posts: 2
Credits: 0
Rep Power: 0
skoe is on a distinguished road
Thumbs up

Quote:
Originally Posted by anupm View Post
fprintf(stderr, "--Name() Id(%s) Salary(%f)-------\n", employee.getid(), employee.getSalary()) ;
Hi,

The %s argument requires a c-styled string, but you've passed it an actual std::string object.
Try:
C++ Code:
  1. fprintf(stderr, "--Name()  Id(%s)  Salary(%f)-------\n",  employee.getid().c_str(), employee.getSalary());
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML-JSP content Type problem hbmehta15 JavaScript and CSS 3 06-19-2007 04:39 AM
Unbound type constructor snowfall General Programming 0 04-25-2007 04:01 PM
Type Casting clookid PHP Tutorials 1 01-11-2007 09:32 PM
Java:Tutorial - Adding more objects to your window John Java Tutorials 0 01-11-2007 03:09 PM
Objects Nightracer General Programming 8 07-28-2006 09:02 PM


All times are GMT -5. The time now is 06:33 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2684.34
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads