Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 02-05-2020
Avatar de aguml
aguml aguml is offline
Miembro
 
Registrado: may 2013
Posts: 885
Poder: 12
aguml Va por buen camino
Usar las librerias Boost en C++Builder 2010

Bueno amigos, lo primero es que no se como instalarlas asi que me bajé las librerías y fui al directorio "C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\include\" y ya había un directorio llamado "boost_1_34" asi que la sustituí por la de boost_1_73 y cambié la clave de las environment paths para que apunte a esta en vez de a la anterior (solo le cambié el 34 por 73 y el resto quedo igual que estaba). Luego he intentado compilar el ejemplo siguiente que viene en la misma libreria:
Código PHP:
#include <boost\crc.hpp>
#include <string>
#include <iostream>

int main()
{
    
std::string str"The quick brown fox jumps over the lazy dog" );
    
boost::crc_32_type  crc;
    
crc.process_bytesstr.data(), str.size() );

    
std::cout << "Checksum: " << std::hex << crc.checksum() << std::endl;
    return 
0;
}
//--------------------------------------------------------------------------- 
y ahí empiezan los problemas:
Código:
Checking project dependencies...
Compiling Project1.cbproj (Debug configuration)
[BCC32 Error] File1.cpp(3): E2209 Unable to open include file 'boost\crc.hpp'
[BCC32 Error] iosfwd(254): E2238 Multiple declaration for 'char_traits<wchar_t>::int_type'
[BCC32 Error] iosfwd(136): E2344 Earlier declaration of 'char_traits<wchar_t>::int_type'
[BCC32 Error] iosfwd(260): E2238 Multiple declaration for 'char_traits<wchar_t>::assign(wchar_t &,const wchar_t &)'
[BCC32 Error] iosfwd(141): E2344 Earlier declaration of 'char_traits<wchar_t>::assign(wchar_t &,const wchar_t &)'
[BCC32 Error] iosfwd(265): E2238 Multiple declaration for 'char_traits<wchar_t>::eq(const wchar_t &,const wchar_t &)'
[BCC32 Error] iosfwd(146): E2344 Earlier declaration of 'char_traits<wchar_t>::eq(const wchar_t &,const wchar_t &)'
[BCC32 Error] iosfwd(270): E2238 Multiple declaration for 'char_traits<wchar_t>::lt(const wchar_t &,const wchar_t &)'
[BCC32 Error] iosfwd(151): E2344 Earlier declaration of 'char_traits<wchar_t>::lt(const wchar_t &,const wchar_t &)'
[BCC32 Error] iosfwd(276): E2238 Multiple declaration for 'char_traits<wchar_t>::compare(const wchar_t *,const wchar_t *,unsigned int)'
[BCC32 Error] iosfwd(156): E2344 Earlier declaration of 'char_traits<wchar_t>::compare(const wchar_t *,const wchar_t *,unsigned int)'
[BCC32 Error] iosfwd(283): E2238 Multiple declaration for 'char_traits<wchar_t>::length(const wchar_t *)'
[BCC32 Error] iosfwd(167): E2344 Earlier declaration of 'char_traits<wchar_t>::length(const wchar_t *)'
[BCC32 Error] iosfwd(290): E2238 Multiple declaration for 'char_traits<wchar_t>::copy(wchar_t *,const wchar_t *,unsigned int)'
[BCC32 Error] iosfwd(176): E2344 Earlier declaration of 'char_traits<wchar_t>::copy(wchar_t *,const wchar_t *,unsigned int)'
[BCC32 Error] iosfwd(298): E2238 Multiple declaration for 'char_traits<wchar_t>::find(const wchar_t *,unsigned int,const wchar_t &)'
[BCC32 Error] iosfwd(187): E2344 Earlier declaration of 'char_traits<wchar_t>::find(const wchar_t *,unsigned int,const wchar_t &)'
[BCC32 Error] iosfwd(305): E2238 Multiple declaration for 'char_traits<wchar_t>::move(wchar_t *,const wchar_t *,unsigned int)'
[BCC32 Error] iosfwd(197): E2344 Earlier declaration of 'char_traits<wchar_t>::move(wchar_t *,const wchar_t *,unsigned int)'
[BCC32 Error] iosfwd(312): E2238 Multiple declaration for 'char_traits<wchar_t>::assign(wchar_t *,unsigned int,wchar_t)'
[BCC32 Error] iosfwd(212): E2344 Earlier declaration of 'char_traits<wchar_t>::assign(wchar_t *,unsigned int,wchar_t)'
[BCC32 Error] iosfwd(323): E2238 Multiple declaration for 'char_traits<wchar_t>::to_int_type(const wchar_t &)'
[BCC32 Error] iosfwd(227): E2344 Earlier declaration of 'char_traits<wchar_t>::to_int_type(const wchar_t &)'
[BCC32 Error] iosfwd(334): E2238 Multiple declaration for 'char_traits<wchar_t>::eof()'
[BCC32 Error] iosfwd(238): E2344 Earlier declaration of 'char_traits<wchar_t>::eof()'
[BCC32 Error] iosfwd(355): E2238 Multiple declaration for 'char_traits<char>::assign(char &,const char &)'
[BCC32 Error] iosfwd(141): E2344 Earlier declaration of 'char_traits<char>::assign(char &,const char &)'
[BCC32 Error] iosfwd(360): E2238 Multiple declaration for 'char_traits<char>::eq(const char &,const char &)'
[BCC32 Error] iosfwd(146): E2344 Earlier declaration of 'char_traits<char>::eq(const char &,const char &)'
[BCC32 Error] iosfwd(365): E2238 Multiple declaration for 'char_traits<char>::lt(const char &,const char &)'
[BCC32 Error] iosfwd(151): E2344 Earlier declaration of 'char_traits<char>::lt(const char &,const char &)'
[BCC32 Error] iosfwd(371): E2238 Multiple declaration for 'char_traits<char>::compare(const char *,const char *,unsigned int)'
[BCC32 Error] iosfwd(156): E2344 Earlier declaration of 'char_traits<char>::compare(const char *,const char *,unsigned int)'
[BCC32 Error] iosfwd(378): E2238 Multiple declaration for 'char_traits<char>::length(const char *)'
[BCC32 Error] iosfwd(167): E2344 Earlier declaration of 'char_traits<char>::length(const char *)'
[BCC32 Error] iosfwd(385): E2238 Multiple declaration for 'char_traits<char>::copy(char *,const char *,unsigned int)'
[BCC32 Error] iosfwd(176): E2344 Earlier declaration of 'char_traits<char>::copy(char *,const char *,unsigned int)'
[BCC32 Error] iosfwd(393): E2238 Multiple declaration for 'char_traits<char>::find(const char *,unsigned int,const char &)'
[BCC32 Error] iosfwd(187): E2344 Earlier declaration of 'char_traits<char>::find(const char *,unsigned int,const char &)'
[BCC32 Error] iosfwd(400): E2238 Multiple declaration for 'char_traits<char>::move(char *,const char *,unsigned int)'
[BCC32 Error] iosfwd(197): E2344 Earlier declaration of 'char_traits<char>::move(char *,const char *,unsigned int)'
[BCC32 Error] iosfwd(407): E2238 Multiple declaration for 'char_traits<char>::assign(char *,unsigned int,char)'
[BCC32 Error] iosfwd(212): E2344 Earlier declaration of 'char_traits<char>::assign(char *,unsigned int,char)'
[BCC32 Error] iosfwd(418): E2238 Multiple declaration for 'char_traits<char>::to_int_type(const char &)'
[BCC32 Error] iosfwd(227): E2344 Earlier declaration of 'char_traits<char>::to_int_type(const char &)'
[BCC32 Error] iosfwd(429): E2238 Multiple declaration for 'char_traits<char>::eof()'
[BCC32 Error] iosfwd(238): E2344 Earlier declaration of 'char_traits<char>::eof()'
[BCC32 Error] xutility(345): E2406 Dependent type qualifier 'bool' is not a class or struct type
[BCC32 Error] xutility(346): E2406 Dependent type qualifier 'bool' is not a class or struct type
[BCC32 Error] xutility(347): E2406 Dependent type qualifier 'bool' is not a class or struct type
[BCC32 Error] xutility(347): E2228 Too many error or warning messages
Failed
Elapsed time: 00:00:00.2
Así tengo la variable de entorno:
Código:
Variable name: CG_BOOST_ROOT
Variable value: C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\include\boost_1_73
No se que hacer
Gracias por adelantado.
Responder Con Cita
  #2  
Antiguo 02-05-2020
Avatar de aguml
aguml aguml is offline
Miembro
 
Registrado: may 2013
Posts: 885
Poder: 12
aguml Va por buen camino
Vale, he añadido "$(BDS)\include\boost_1_73" a Include Path y a Library Path y parece que ya lo reconoce pero ahora me da otros errores relacionados con los archivos de esa librería:
En la linea:
Código PHP:
#define WCHAR_MAX UINT16_MAX 
Código:
[BCC32 Warning] stdint.h(168): W8017 Redefinition of 'WCHAR_MAX' is not identical
Otro:
Código PHP:
bool const integral_constant<boolval>::value
Código:
[BCC32 Error] integral_constant.hpp(90): E2316 'value' is not a member of 'integral_constant<bool,val>'
Otro:
Código PHP:
enum static_size }; 
Código:
[BCC32 Error] array.hpp(155): E2324 Numeric constant too large
Otro:
Código PHP:
boost::array<unsigned char, ( UINTMAX_C(1) << CHAR_BIT )>  result
Código:
[BCC32 Error] crc.hpp(411): E2450 Undefined structure 'array<unsigned char,256>
[BCC32 Error] crc.hpp(411): E2449 Size of 'result' is unknown or zero'
Otro:
Código PHP:
static  boost::array<unsigned char, ( UINTMAX_C(1) << CHAR_BIT )> const
          
table make_byte_reflection_table(); 
Código:
[BCC32 Error] crc.hpp(438): E2450 Undefined structure 'array<unsigned char,256>'
No encuentro por internet como solucionar todos estos fallos
Responder Con Cita
  #3  
Antiguo 02-05-2020
Avatar de aguml
aguml aguml is offline
Miembro
 
Registrado: may 2013
Posts: 885
Poder: 12
aguml Va por buen camino
Bueno, por lo visto tiene que ser alguna incompatibilidad con la ultima versión porque el mismo código funciona perfectamente en la que ya tenia.
Ahora tengo una duda, viendo códigos de otros usuarios he conseguido armarme esto:
Código PHP:
#include <vcl.h>
#include <boost\crc.hpp>
#include <iostream>
#include <fstream>
#pragma hdrstop

//---------------------------------------------------------------------------

#pragma argsused

uint32_t crc32(std::istream &is)
{
    
char buf[4096];
    
boost::crc_32_type result;

    do {
        
is.read(bufsizeof buf);
        
result.process_bytes(bufis.gcount());
    } while (
is);

    if (
is.eof()) {
        return 
result.checksum();
    } else {
        throw 
std::runtime_error("File read failed");
    }
}
//---------------------------------------------------------------------------

int _tmain(int argc_TCHARargv[])
{
    
ifstream myfile;
    
myfile.open("mi_archivo.bin"ios::in ios::app ios::binary);
    
uint32_t crc=crc32(myfile);
    
myfile.close();
    
std::cout << crc << std::endl;
    
std::getchar();

    return 
0;

La cosa es que no será una aplicacion de consola donde quiero usarlo y a ser posible evitar añadir las librerias de C++ y usar las de C++Builder y no se como sustituir fstream e iostream para usar las propias de C++builder. ¿podeis ayudarme con eso?
Responder Con Cita
  #4  
Antiguo 04-05-2020
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Poder: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Puedes usar stream de la VLC (TFileStream) o leer el archivo sobre un buffer con _lread((int)hFile, Buffer, Size) que forma parte de las dll de Windows.

Saludos.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
¿reporteador freeware para C++builder 6 hasta 2010-XE2 XE3 XE4 XE5 XE7 Seatle 2010? JXJ C++ Builder 5 19-03-2016 01:11:32
reportes c++ builder 2010 ps_papis Impresión 4 01-11-2011 01:36:08
Usar librerías dinámicas zairillo C++ Builder 5 23-02-2010 13:01:55
librerias para usar Servers Quin C++ Builder 0 26-09-2006 16:45:27
Como usar librerias de Paradox en Delphi Mario1980 Varios 2 07-10-2004 14:56:07


La franja horaria es GMT +2. Ahora son las 02:04:09.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi