Pablo,

Put this in your header file :-

CString FloatATexto(float numero, int cantDecimales);

and the rest of the function in one source file only, then it will work.



-----Original Message-----
From: Pablo Martin Vera [mailto:[EMAIL PROTECTED]
Sent: 18 September 2003 13:57
To: Palm Developer Forum
Subject: global function


If I defined a global function in a .h I�ve got a linker error in every form
that it says that�s already define in starter.cpp

I place the function in common.h
heres the code:

//COMMON.H

#ifndef COMMON_H_
#define COMMON_H_

#include <POL.h>

using namespace POL;

#include "Preventa_Rsc.h"

#define noVisitado 0
#define noAtendido 1
#define pendiente 2


enum eRutas
{
        eRutas_Todas=0,
        eRutas_Lunes=1,
        eRutas_Martes=2,
        eRutas_Miercoles=3,
        eRutas_Jueves=4,
        eRutas_Viernes=5,
        eRutas_Sabado=6,
        eRutas_Domingo=7

};

enum eEstados
{
        eEstados_Pendiente=0,
        eEstados_NoAtendido=1,
        eEstados_Atendido=2
};



struct typDatosApp
        {
                CString ClienteId;
                int Secuencia;
                UInt8 Dia;              
                CString RazonSocial;
                CString Direccion;
        };



//CString FloatATexto(float,int);

CString FloatATexto(float numero, int cantDecimales)
{
        long NumAMultiplicar=10;
        long parte_entera;
        long parte_decimal;
        CString strDecimal;
        CString strNumero;
        
        //elevo a la potencia el numero para obtener el multiplicador
correcto para la cantidad de decimales deseada
        for (int i=1;i<cantDecimales;i++)
                NumAMultiplicar*=10;    
        
        parte_entera=(long) numero;
        parte_decimal= (numero-parte_entera)*NumAMultiplicar;

        strDecimal.Format("%ld",parte_decimal);

        //completa con ceros la parte decimal seguna la cantidad de
decimales deseada
        if (strDecimal.GetLength()<cantDecimales)
                for (int i=1;i<cantDecimales;i++)
                        strDecimal+="0";
                                
        strNumero.Format("%ld,",parte_entera);
        strNumero+=strDecimal;
        
        return strNumero;       
}

#endif // COMMON_H_

-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/

_____________________________________________________________________

This message has been checked for all known viruses on behalf of Vivista by
MessageLabs. 

http://www.messagelabs.com or Email: [EMAIL PROTECTED]

Vivista formerly Securicor Information Systems for further information
http://www.vivista.co.uk  



**********************************************************************
The information contained in this e-mail message is intended
only for the individuals named above.  If you are not the 
intended recipient, you should be aware that any 
dissemination, distribution, forwarding or other duplication 
of this communication is strictly prohibited.  The views 
expressed in this e-mail are those of the individual author 
and not necessarily those of Vivista Limited.  
Prior to taking any action based upon this e-mail message 
you should seek appropriate confirmation of its authenticity.
If you have received this e-mail in error, please immediately 
notify the sender by using the e-mail reply facility.
**********************************************************************


_____________________________________________________________________

This message has been checked for all known viruses on behalf of Vivista by 
MessageLabs. 

http://www.messagelabs.com or Email: [EMAIL PROTECTED]

Vivista formerly Securicor Information Systems for further information 
http://www.vivista.co.uk  


--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to