请教关于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
...全文
988 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
  • 打赏
  • 举报
回复
换个链接方式估计就行了。
内容概要:本文档围绕“风储VSG-基于虚拟同步发电机的风储并网系统Simulink仿真”展开,系统介绍了采用虚拟同步发电机(VSG)控制策略的风电与储能联合并网系统的建模与仿真方法。通过Simulink平台构建完整的电力系统动态模型,重点实现VSG的关键控制逻辑,以提升新能源并网的稳定性、惯性响应与频率支撑能力。文档不仅涵盖核心仿真模型,还整合了大量相关前沿研究内容,如混合储能调频、微电网优化、电动汽车可调能力评估、智能算法在电力系统中的应用等,并提供丰富的Matlab/Simulink代码实例,具有较强的科研复现价值和技术参考意义。; 适合人群:具备电力系统基础理论知识和Matlab/Simulink仿真能力的研究生、科研人员及从事新能源发电、储能控制、智能电网等领域工作的工程技术人员;特别适用于正在开展风储协同控制、虚拟同步机、构网型变流器等相关课题研究的高校师生。; 使用场景及目标:① 深入理解虚拟同步发电机(VSG)在风储并网系统中的控制原理与技术优势;② 借助提供的仿真模型与代码完成科研论文复现、算法验证与系统性能测试;③ 探索新能源高渗透背景下提升电网稳定性的关键技术路径,包括惯量模拟、一次频率响应、储能协同控制等。; 阅读建议:建议读者按照文档结构循序渐进地学习,优先下载并运行配套的Simulink模型与Matlab代码,结合VSG控制策略的设计细节进行调试与分析,同时可关注公众号“荔枝科研社”获取完整资源包及持续的技术支持,以提升科研效率与创新能力。

7,539

社区成员

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

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