请教关于fatal error LNK1104: 无法打开文件“libcimt.lib”解决方法

greatzj88 2011-01-07 04:42:22
大家好,最近由于工作需要,找到了一个ppmd压缩,解压算法,算法是用VC6.0开发的,但是转换成VS2005的项目后,总是报错fatal error LNK1104: 无法打开文件“libcimt.lib”。我已将VC6下的ppmd_coder.h 中#include <iostream.h>、#include <fstream.h>改成了#include <iostream>、#include <fstream>,并使用了using namespace std命令。感觉问题出在fstream,但耐与能力有限,找不出问题的真正所在,烦请各位大侠给予指点帮助。
ppmd算法的下载地址:http://hi.baidu.com/%B4%F3%D5%AC%C0%C7/blog/item/68fb6f55df0164133b293516.html
现将ppmd_coder.h附上,希望各位大侠给提供个解决思路,谢谢。

#ifndef PPMD_CODER_HEADER_0F508BAB_5509_11d5_83F2_000102A39096
#define PPMD_CODER_HEADER_0F508BAB_5509_11d5_83F2_000102A39096

/** PPMD_Coder is a class to compress and uncompress a file using the very
sophisticated PPMD method. It is based on the public domain code by Dmitry
Shkarin which is widely available. Please notice that only one file can
compressed, archiving several files can be done with the help of TAR.

There is no general rule which OrderSize to use. If you have highly repeatable
data it's worth to use a high value but in general this should be avoided
because the overhead is slightly greater and would increase your output file
compared to smaller OrderSizes. Just play around with the values to see what
I mean.

The SubAllocatorSize is the size in MB which will be allocated dynamically
on the heap. Only use high values if you have enough memory.

You must include the "ppmd.lib" in your project!

Please send any bugs to:
Andreas Muegge <andreas.muegge@gmx.de> or <andreas@starke-muegge.de>

2001-30-05
*/

#include <iostream.h>
#include <fstream.h>
#include <exception>
#include <wtypes.h>
#include <stdio.h>
#include <string>

// functions implemented in the static library "ppmd.lib"
BOOL __stdcall StartSubAllocator(int SubAllocatorSize);
void __stdcall StopSubAllocator();
DWORD __stdcall GetUsedMemory();

void __stdcall EncodeFile(ofstream & EncodedFile,
ifstream & DecodedFile,
int MaxOrder);

void __stdcall DecodeFile(ofstream & DecodedFile,
ifstream & EncodedFile,
int MaxOrder);

class PPMD_Coder
{
public:
/** Parameters are:
szIn - file to read in
szOut - file to write compressed/uncompressed data to. If this
parameter is NULL the extension "ppm" will be added
(Compression) or the original filename stored in the
archive will be used (Decompression)
nSub - Memory to use for compression in MBytes (1..256)
nOrder - Ordersize (2..16)
*/
PPMD_Coder(const TCHAR* szIn, const TCHAR* szOut = NULL,
int nSub = 16, int nOrder = 6 )
: m_nOrder(nOrder), m_nSubAllocatorSize(nSub),
SIGNATURE("PPMD_A"), m_nMemory(0)
{ m_szIn = szIn; m_szOut = szOut; }

~PPMD_Coder() { }

/** Play around with the order sizes. Higher values require more
overhead so you must find the right balance. Values between 4 and 6
are good starting points. */
int OrderSize(int nOrder)
{
m_nOrder = nOrder;
m_nOrder = max(nOrder, 2); // make sure that nOrder > 0
m_nOrder = min(nOrder, 16); // make sure that nOrder <= 16
return m_nOrder;
}

/** Specify how much memory (in MBytes) can be used. */
int SubAllocatorSize(int nSub)
{
m_nSubAllocatorSize = nSub;
m_nSubAllocatorSize = max(m_nSubAllocatorSize, 1);
m_nSubAllocatorSize = min(m_nSubAllocatorSize, 256);

return m_nSubAllocatorSize;
}

/** Access functions for OrderSize and SubAllocatorSize */
int OrderSize() { return m_nOrder; }
int SubAllocatorSize() {return m_nSubAllocatorSize; }

/** Compress the file, return FALSE if an error occured */
bool Compress();

/** Uncompress file. */
bool Uncompress();


/** Return the memory used. */
void GetMemoryUsage(DWORD & nMB, DWORD & nBytes)
{
nMB = m_nMemory >> 18;
nBytes = (10U*(m_nMemory-(nMB << 18))+(1 << 17)) >> 18;
if (nBytes == 10)
{
nMB++;
nBytes = 0;
}
}

/** Return size of input file */
DWORD GetInputSize() {return m_nInfileSize; }

/** Return size of output file */
DWORD GetOutputSize() {return m_nOutfileSize; }

/** Return compression ratio */
float GetRatio()
{
if (m_nInfileSize == 0 || m_nOutfileSize == 0)
return 0.0;

return (100.0 - float(m_nOutfileSize * 100.0 / m_nInfileSize) );
}

/** Return compression ratio */
float GetRatioUncompressed()
{
if (m_nInfileSize == 0 || m_nOutfileSize == 0)
return 0.0;

return (100.0 - float(m_nInfileSize * 100.0 / m_nOutfileSize) );
}

private:
const TCHAR* m_szIn;
std::string m_szOut;
const char* SIGNATURE;
int m_nOrder;
int m_nSubAllocatorSize;
DWORD m_nMemory;
DWORD m_nInfileSize;
DWORD m_nOutfileSize;
};


//////////////////////////////////////////////////////////////////////////
bool PPMD_Coder::Compress()
{
ifstream Infile(m_szIn, ios::in | ios::nocreate | ios::binary);
if (!Infile.is_open() )
{
char szTemp[512];
sprintf(szTemp, "Couldn't open file <%s>!", m_szIn);
throw exception(szTemp);
return FALSE;
}

if (m_szOut.empty())
{
m_szOut = m_szIn;
m_szOut += ".ppm";
}

ofstream Outfile(m_szOut.c_str(), ios::out | ios::trunc | ios::binary);
if (!Outfile.is_open())
{
std::string szError = "Couldn't open file <";
szError += m_szOut;
szError += ">!";

throw exception(szError.c_str());
return FALSE;
}

Outfile.write(SIGNATURE, strlen(SIGNATURE));
Outfile.put(static_cast<char> (m_nOrder) );
Outfile.put(static_cast<char> (m_nSubAllocatorSize - 1) );

// Write filename-length and filename of input file.
// You could also store filedate and attributes here.
int nLen = strlen(m_szIn);
Outfile.write(reinterpret_cast<char*> (&nLen), sizeof(nLen) );
Outfile.write(m_szIn, nLen);

if (!StartSubAllocator(m_nSubAllocatorSize))
{
throw exception("Memory allocation for PPMD failed!");
return FALSE;
}

EncodeFile(Outfile, Infile, m_nOrder);

m_nMemory = GetUsedMemory();

StopSubAllocator();

m_nInfileSize = Infile.tellg();
m_nOutfileSize = Outfile.tellp();

Outfile.flush();
Infile.close(); Outfile.close();

return TRUE;
}


bool PPMD_Coder::Uncompress()
{
ifstream Infile(m_szIn, ios::in | ios::nocreate | ios::binary);
if (!Infile.is_open() )
{
char szTemp[512];
sprintf(szTemp, "Couldn't open file <%s>!", m_szIn);
throw exception(szTemp);
return FALSE;
}

char szTemp[8];
Infile.read(szTemp, strlen(SIGNATURE));

szTemp[6] = '\0';
if (strcmp(szTemp, SIGNATURE) != 0)
{
// file not created by this program!
throw exception("Wrong signature found, cannot uncompress file!");
return FALSE;
}

m_nOrder = Infile.get();
m_nSubAllocatorSize = Infile.get() +1;

int nLen;
Infile.read(reinterpret_cast<char*> (&nLen), sizeof(nLen) );

char *szOutTemp = new char[nLen+1];
Infile.read(szOutTemp, nLen);
szOutTemp[nLen] = '\0';

if (m_szOut.empty())
m_szOut = szOutTemp;

ofstream Outfile(m_szOut.c_str(), ios::out | ios::trunc | ios::binary);
if (!Outfile.is_open())
{
delete szOutTemp;

char szTemp[512];
sprintf(szTemp, "Couldn't open file <%s>!", m_szOut);
throw exception(szTemp);
return FALSE;
}

delete szOutTemp;

if (!StartSubAllocator(m_nSubAllocatorSize))
{
throw exception("Memory allocation for PPMD failed!");
return FALSE;
}

DecodeFile(Outfile, Infile, m_nOrder);

m_nMemory = GetUsedMemory();

StopSubAllocator();

m_nInfileSize = Infile.tellg();
m_nOutfileSize = Outfile.tellp();

Outfile.flush();
Infile.close(); Outfile.close();

return TRUE;
}



#endif
...全文
772 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
greatzj88 2011-01-12
  • 打赏
  • 举报
回复
不知 海风 说的“将这个lib的源码在vs2005下编译一下,基本就可以了。”是什么意思?
libcimt.lib是6.0自带库,哪能搞到源码?
等待大侠们的帮助
mngzilin 2011-01-10
  • 打赏
  • 举报
回复
将这个lib的源码在vs2005下编译一下,基本就可以了。
greatzj88 2011-01-09
  • 打赏
  • 举报
回复
ppmd算法的下载地址:http://hi.baidu.com/%B4%F3%D5%AC%C0%C7/blog/item/68fb6f55df0164133b293516.html

希望大侠们给提个思路,我调试的时候只要包含 fstream.h就会报这个链接错误,貌似以下这个网址能给些帮助http://msdn.microsoft.com/zh-cn/library/8h8eh904(VS.90).aspx
继续等待中。。。。。
lyingbo 2011-01-08
  • 打赏
  • 举报
回复
貌似是动态库的链接问题
代码真长啊
healer_kx 2011-01-07
  • 打赏
  • 举报
回复
换个链接方式估计就行了。
VC编译中出现以下错误时: LINK : fatal error LNK1104: cannot open file 'uafxcwd.lib' 解决方法 1.菜单project-》settnigs-》link-》Object/Library modules:中添加uafxcwd.lib (win7下亲测可用) 2. 如果还是不行,选择vc的全部安装,而不是默认安装 如果是unicode,可以用vc盘修复一下vc,钩选相关项。 如果以上方法不行,可以试试下面的方法。 说明: uafxcwd.lib多见于VC6编译过程中,有时候会遇到“ fatal error LNK1104: cannot open file "uafxcwd.lib"”,意思是找不到uafxcwd.lib库文件,你可在此下载,存放在提示的路径下即可,若缺少这个文件而不修复的话,VC项目可能无法编译成功。如果系统提示“没有找到uafxcwd.lib”、“缺少uafxcwd.lib文件”或者无法加载uafxcwd.lib等提示信息,您需要下载uafxcwd.lib后,拷贝到提示的路径里或在系统内安装注册该文件即可。   安装及使用方法(仅供参考,本方法对BPL文件无效):   ①将下载解压的uafxcwd.lib文件复制到C:\Windows\System32系统目录下(请注意:Win7、Vista的系统目录请以实际为准);   ②打开“开始”菜单-选择“运行”,输入“regsvr32 uafxcwd.lib”,在接下来的窗口中按回车确认即可完成控件注册。   ③如果在运行某一软件或程序编译时提示缺少、没有找到uafxcwd.lib等类似提示,您可按照提示的路径将lib拷贝到指定目录即可,或者重新添加文件引用。

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧