1. 首先从官网下载boost库,
http://nchc.dl.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.7z只使用crc无需编译boost,只需要包含指定的 crc.hpp即可。
2. 下载后解压到d盘:D:\boost_1_53_0
3. 建立控制台工程文件,并做如下设置:

4. 代码如下
// crctest.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"

#include <Windows.h>
#include <iostream>
#include <strstream>
#include <ostream>
#include <list>
#include <string>
#include <boost/crc.hpp>

using namespace std;
using namespace boost;


void _tmain(int argc, _TCHAR* argv[])


{
HANDLE hFile = ::CreateFile(_T("c:\\1.zip"), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(INVALID_HANDLE_VALUE == hFile)

{
cout << "文件不存在" << endl;
return ;
}

//存放到内存中
//取得文件大小(字节)
DWORD dwLen = GetFileSize(hFile, NULL);
char *readBuf = new char[dwLen];
memset(readBuf, 0, dwLen);

DWORD dwReadLen;
//将文件内容存放到 readBuf 中
ReadFile(hFile, readBuf, dwLen, &dwReadLen, NULL);

boost::crc_32_type result;
//计算一个字符的CRC值
//result.process_byte('a');
//计算字符串的CRC值
//result.process_bytes("abc", 3);
//计算文件的CRC值
result.process_block(readBuf, readBuf+dwLen*sizeof(char));

cout << std::hex << std::uppercase << result.checksum() << endl;

::CloseHandle(hFile);

delete []readBuf;

system("pause");
return;
} :