C++ 使用hashlib时出错++;在c++;建设者
我下载了最新的hashlib++0.32版本,并尝试使用哈希函数,但它显示不支持编译器C++ 使用hashlib时出错++;在c++;建设者,c++,encryption,hash,c++builder,C++,Encryption,Hash,C++builder,我下载了最新的hashlib++0.32版本,并尝试使用哈希函数,但它显示不支持编译器 [BCC32 Fatal Error] hl_types.h(71): F1003 Error directive: "Unsuppported compiler." "Please use GCC,MINGW,MSVC " " or define hl_uint64 for your compiler in hl_types.h line 62" hl_
[BCC32 Fatal Error] hl_types.h(71): F1003 Error directive: "Unsuppported compiler." "Please use GCC,MINGW,MSVC " " or define hl_uint64 for your compiler in hl_types.h line 62"
hl_类型。h看起来
/*
* hashlib++ - a simple hash library for C++
*
* Copyright (c) 2007-2010 Benjamin Grьdelbach
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//----------------------------------------------------------------------
/**
* @file hl_types.h
* @brief This file defines some global types
* @date So 13 Jan 2008
*/
//----------------------------------------------------------------------
//include protection
#ifndef HLTYPES_H
#define HLTYPES_H
//----------------------------------------------------------------------
/**
* exactly 1 Byte
*/
typedef unsigned char hl_uint8;
/**
* at least 2 Byte
*/
typedef unsigned short int hl_uint16;
/**
* at least 4 Byte
*/
typedef unsigned int hl_uint32;
/**
* at least 8 Byte
*/
#ifdef __GNUC__
typedef unsigned long long int hl_uint64;
#elif __MINGW32__
typedef unsigned long long int hl_uint64;
#elif _MSC_VER
typedef unsigned __int64 hl_uint64;
#else
#error "Unsuppported compiler." \
"Please use GCC,MINGW,MSVC " \
" or define hl_uint64 for your compiler in hl_types.h line 62"
#endif
//----------------------------------------------------------------------
//end of include protection
#endif
//----------------------------------------------------------------------
//EOF
我问,有没有办法让它在Borland C++ Builder 2010(Bcc32)编译器中工作?< /P> < P>“不支持的编译器”错误来自代码段:
/**
* at least 8 Byte
*/
#ifdef __GNUC__
typedef unsigned long long int hl_uint64;
#elif __MINGW32__
typedef unsigned long long int hl_uint64;
#elif _MSC_VER
typedef unsigned __int64 hl_uint64;
#else
#error "Unsuppported compiler." \
"Please use GCC,MINGW,MSVC " \
" or define hl_uint64 for your compiler in hl_types.h line 62"
#endif
如果你要做大量的编程,你需要学会阅读错误信息。具体地说,消息中说“或在hl_types.h行62中为编译器定义hl_uint64”的部分。您只需添加一行,沿着该部分中其他编译器的行标识64位整数类型。例如:
typedef unsigned long long hl_uint64;
或者,如果Borland允许您访问stdint.h:
#include "stdint.h"
typedef uint64_t hl_uint64;
我认为错误信息基本上说明了该怎么做。。。将以下内容添加到_MSC_VER check下方的头文件和final else上方的头文件:
(生成器有一个“u int64”扩展整数类型)我在hl_types#elif defined(BORLANDC)typedef unsigned u int64 hl_uint64中添加了以下行;
#elif defined( __BORLANDC__ )
typedef unsigned __int64 hl_uint64;