conversion

Hi

I get the following errors when I compile my code:

Compiling...
gpcc.cpp
C:\D\GPS\gpslab\gpcc.cpp(130) : error C2440: '=' : cannot convert from 'double *' to 'double'
There is no context in which this conversion is possible
C:\D\GPS\gpslab\gpcc.cpp(131) : error C2440: '=' : cannot convert from 'double *' to 'double'
There is no context in which this conversion is possible
C:\D\GPS\gpslab\gpcc.cpp(132) : error C2440: 'type cast' : cannot convert from 'double' to 'double *'
There is no context in which this conversion is possible
C:\D\GPS\gpslab\gpcc.cpp(133) : error C2440: 'type cast' : cannot convert from 'double' to 'double *'
There is no context in which this conversion is possible
C:\D\GPS\gpslab\gpcc.cpp(134) : error C2440: 'type cast' : cannot convert from 'double' to 'double *'
There is no context in which this conversion is possible
C:\D\GPS\gpslab\gpcc.cpp(135) : error C2440: '=' : cannot convert from 'double *' to 'double'
There is no context in which this conversion is possible
C:\D\GPS\gpslab\gpcc.cpp(137) : error C2664: 'CINRun' : cannot convert parameter 1 from 'double ** ' to 'double *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

gpslab.dll - 7 error(s), 0 warning(s)

Thank you
[1664 byte] By [tudinia] at [2007-11-18 20:30:13]
# 1 Re: conversion
Your error is very simple:

double * lat1_deg,lat1_min;

This is the equivalent of doing this:

double *lat1_deg; // pointer to double
double lat1_min; // double

Now do you see your error? You are assuming that lat1_min was declared as a pointer to double, when it wasn't -- it is a double (I shortened the line where the declaration occurs to illustrate this). In C++ (and C), when you declare multiple variables with one declarator, the "*" goes with the name, not with the type.

To correct this error, break up the declaration into seperate lines:

double *lat1_deg,
*lat1_min,
*lat1_sec, /* etc... */

*Event1_start;

Note that each variable declared is a pointer, not just the first one.

Regards,

Paul McKenzie
Paul McKenzie at 2007-11-11 1:12:37 >