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/

Reply via email to