[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cannot pass objects of non-POD type
From: |
Vijay |
Subject: |
cannot pass objects of non-POD type |
Date: |
13 Oct 2004 04:36:45 -0700 |
Hi all,
Im using
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-20)
on 64bit linux server
im trying to compile following code
--------------------sam.cpp---------------------
#include <string>
#include <iostream>
#include <stdarg.h>
using namespace std;
void Write( const char* msg, const char* msg2, ...)
{
cout <<msg <<" "<<msg2<<endl;
}
int main()
{
string str("World");
Write("Hello","Debug out %s" ,str);
return 0;
}
-------------------------------------------
When i compile this code i get following compilation warning .
[oracle@sahyagiri test]$ g++ sam.cpp
sam.cpp: In function `int main()':
sam.cpp:17: warning: cannot pass objects of non-POD
type `struct std::string'
through `...'; call will abort at runtime
When i run the executable, a.out it fails with Illegal
instruction eror
[oracle@sahyagiri test]$ ./a.out
Illegal instruction
[oracle@sahyagiri test]$
Did any one face this problem, if yes is there any one
workaround to this problem.
i guess this is a issue with compiler gcc 3.2.3
because i tries same this with gcc 2.95, though it
gives warning while compilation, but executable runs
with out any runtime error.
Thanks and Regards
Vijay
- cannot pass objects of non-POD type,
Vijay <=