472,952 Members | 1,835 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

g++ compilation - invalid conversion from void* to double*

Hi all,

uname -a
SunOS cbmrsd1a1 5.10 Generic_118833-17 sun4us sparc FJSV,GPUZC-M

g++ -v
Reading specs from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.10/3.3.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.3.2

With 32 bit compilation, I compiled my application code successfully -
But I got the following errors when I tried 64-bit compilation by
giving options (-m64, -mcpu=v9) -

/usr/local/bin/g++ -m64 -mcpu=v9 -c -o PVA/PVA_ValueTable.o
PVA/PVA_ValueTable.cpp

/usr/local/include/c++/3.3.2/bits/stl_vector.h: In member function
`_Tp*
std::_Vector_alloc_base<_Tp, _Allocator, _IsStatic>::_M_allocate(long
unsigned int) [with _Tp = double, _Allocator = EFL_Allocator<double>,
bool
_IsStatic = false]':
/usr/local/include/c++/3.3.2/bits/vector.tcc:236: instantiated from
`void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx:
:__normal_iterator<_Tp*, std::vector<_Tp, _Alloc, const _Tp&) [with
_Tp = double, _Alloc = EFL_Allocator<double>]'
/usr/local/include/c++/3.3.2/bits/stl_vector.h:603: instantiated from
`void std::vector<_Tp, _Alloc>::push_back(const _Tp&)
[with _Tp = double, _Alloc = EFL_Allocator<double>]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:779:
instantiated from `void PVA_ValueTableColumnImpl
<T>::add(T) [with T = double]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:1231:
instantiated from here
/usr/local/include/c++/3.3.2/bits/stl_vector.h:97: error: invalid
conversion
from `void*' to `double*'
/usr/local/include/c++/3.3.2/bits/stl_vector.h: In member function
`_Tp*
std::_Vector_alloc_base<_Tp, _Allocator, _IsStatic>::_M_allocate(long
unsigned int) [with _Tp = float, _Allocator = EFL_Allocator<float>,
bool
_IsStatic = false]':
/usr/local/include/c++/3.3.2/bits/vector.tcc:236: instantiated from
`void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx:
:__normal_iterator<_Tp*, std::vector<_Tp, _Alloc, const _Tp&) [with
_Tp = float, _Alloc = EFL_Allocator<float>]'
/usr/local/include/c++/3.3.2/bits/stl_vector.h:603: instantiated from
`void std::vector<_Tp, _Alloc>::push_back(const _Tp&)
[with _Tp = float, _Alloc = EFL_Allocator<float>]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:779:
instantiated from `void PVA_ValueTableColumnImpl
<T>::add(T) [with T = float]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:1241:
instantiated from here
/usr/local/include/c++/3.3.2/bits/stl_vector.h:97: error: invalid
conversion
from `void*' to `float*'

But the same thing got compiled with 32 bit compilation. No clues, why
its failing to convert from void* to long*, double*, float*, short*
with
only 64 bit compilation...

Thanks in Advance...

Sep 12 '06 #1
2 13369
tk*********@gmail.com writes:
But the same thing got compiled with 32 bit compilation. No clues, why
its failing to convert from void* to long*, double*, float*, short*
with
only 64 bit compilation...
At first, you need to show the code in question, since noone can tell
what line 97 of bits/stl_vector.hpp of your version of gcc is without
downloading it.

Then, this question is more suited for a gcc-secific group, since
c.l.c++ is more targetted to platform independent discussion.

Jens
Sep 12 '06 #2
tk*********@gmail.com wrote:
Hi all,

uname -a
SunOS cbmrsd1a1 5.10 Generic_118833-17 sun4us sparc FJSV,GPUZC-M

g++ -v
Reading specs from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.10/3.3.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.3.2

With 32 bit compilation, I compiled my application code successfully -
But I got the following errors when I tried 64-bit compilation by
giving options (-m64, -mcpu=v9) -

/usr/local/bin/g++ -m64 -mcpu=v9 -c -o PVA/PVA_ValueTable.o
PVA/PVA_ValueTable.cpp

/usr/local/include/c++/3.3.2/bits/stl_vector.h: In member function
`_Tp*
std::_Vector_alloc_base<_Tp, _Allocator, _IsStatic>::_M_allocate(long
unsigned int) [with _Tp = double, _Allocator = EFL_Allocator<double>,
bool
_IsStatic = false]':
/usr/local/include/c++/3.3.2/bits/vector.tcc:236: instantiated from
`void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx:
:__normal_iterator<_Tp*, std::vector<_Tp, _Alloc, const _Tp&) [with
_Tp = double, _Alloc = EFL_Allocator<double>]'
/usr/local/include/c++/3.3.2/bits/stl_vector.h:603: instantiated from
`void std::vector<_Tp, _Alloc>::push_back(const _Tp&)
[with _Tp = double, _Alloc = EFL_Allocator<double>]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:779:
instantiated from `void PVA_ValueTableColumnImpl
<T>::add(T) [with T = double]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:1231:
instantiated from here
/usr/local/include/c++/3.3.2/bits/stl_vector.h:97: error: invalid
conversion
from `void*' to `double*'
/usr/local/include/c++/3.3.2/bits/stl_vector.h: In member function
`_Tp*
std::_Vector_alloc_base<_Tp, _Allocator, _IsStatic>::_M_allocate(long
unsigned int) [with _Tp = float, _Allocator = EFL_Allocator<float>,
bool
_IsStatic = false]':
/usr/local/include/c++/3.3.2/bits/vector.tcc:236: instantiated from
`void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx:
:__normal_iterator<_Tp*, std::vector<_Tp, _Alloc, const _Tp&) [with
_Tp = float, _Alloc = EFL_Allocator<float>]'
/usr/local/include/c++/3.3.2/bits/stl_vector.h:603: instantiated from
`void std::vector<_Tp, _Alloc>::push_back(const _Tp&)
[with _Tp = float, _Alloc = EFL_Allocator<float>]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:779:
instantiated from `void PVA_ValueTableColumnImpl
<T>::add(T) [with T = float]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:1241:
instantiated from here
/usr/local/include/c++/3.3.2/bits/stl_vector.h:97: error: invalid
conversion
from `void*' to `float*'

But the same thing got compiled with 32 bit compilation. No clues, why
its failing to convert from void* to long*, double*, float*, short*
with
only 64 bit compilation...

Thanks in Advance...
For a guide on how to post on this newsgroup, please see point 5.8 of
Mashall Clines excellent FAQ:
http://www.parashift.com/c++-faq-lite/how-to-post.html

One requirement would be to send a complete and minimal testcase.
Something like:

int main() {
void *p;
double *d = p; // works in C, compile error in C++
}

int main() {
void *p;
double *d = (double *) p; // works for C and C++
}

It is possible, that this has to do with malloc and the grey area of
grateful incompatibilities between C/C++ , but this stuff is over my
head. Just do the "right thing" in the first place (which, according to
P.J. Plauger: http://www.thescripts.com/forum/post844763-55.html) is
using explicit casts, as given in my second example. In your case the
bug seems to be not in your own code, but in the library.

I thus think, you are in the wrong newsgroup, a more helpful place
would probably be http://gcc.gnu.org/ml/gcc-help/ as this seems to be a
bug with a very specific std library version of a very specific
compiler, that probably has been fixed for several years.

Yours, Felix

Sep 12 '06 #3

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

Similar topics

10
by: jeff regoord | last post by:
A user inputs a float value. The scanf() function gets the value. However, I need to create an error handler with an if else statement saying invalid input if the input is not a number. Does...
5
by: spoilsport | last post by:
Ive got to write a multi-function program and I'm plugging in the functions but I keep getting this error from line 40. Im new to this and cant find an answer anywhere. Sam #include...
31
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
1
by: hunter hou | last post by:
Hello,Please look at the following code(from C++ in a nutshell) and my questions.Thanks,***Hunter... typedef void (*strproc)(const char*); void print(const char* str) { std::cout << "const...
14
by: Richard G. Riley | last post by:
Would it be wrong to use "implicit casting" instead of the standards "implicit conversion" when talking about implicit conversions between certain data types. The standard mentions "explicit...
11
by: Martin Jørgensen | last post by:
Hi, I'm using this alloc_mem-function: - - - - - - - - - - - - - - - - - - - - - - - - void *alloc_mem (size_t num_elems, size_t elem_size, char *filename, int line, size_t *total_mem) {
3
by: Gary Wessle | last post by:
Hi I am trying to return a derived type pointer as the base type pointer and the compiler is complaining, here is what I mean. class A { public: A(){} virtual void lol()=0; };
4
by: tom | last post by:
I have a code segment list below, for the function call "calc()" in the main function, a standard conversion from "double"->"int" is made while "double"->"LongDouble" is also viable, does anyone...
1
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.