您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> VC/MFC >> [求助]DLL初级问题

[求助]DLL初级问题

来源:网络整理     时间:2016/8/18 8:18:10     关键词:

关于网友提出的“ [求助]DLL初级问题”问题疑问,本网通过在网上对“ [求助]DLL初级问题”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: [求助]DLL初级问题
描述:

我做了一个DLL,
代码清单如下:


// StrUse.h: interface for the CStrUse class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_STRUSE_H__333F92F4_5C77_45AE_BEA5_87898E164DB4__INCLUDED_)
#define AFX_STRUSE_H__333F92F4_5C77_45AE_BEA5_87898E164DB4__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifdef STRUSE_BLD
#define DLL __declspec(dllexport)
#else
#define DLL
#endif
class DLL CStrUse  
{
public:
static CString StrRep(LPSTR pszString);
CStrUse();
virtual ~CStrUse();
};
#endif // !defined(AFX_STRUSE_H__333F92F4_5C77_45AE_BEA5_87898E164DB4__INCLUDED_)

// StrUse.cpp: implementation of the CStrUse class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "StrUse.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CStrUse::CStrUse()
{
}
CStrUse::~CStrUse()
{
}
CString CStrUse::StrRep(LPSTR pszString)
{
CString str = pszString;
str.Replace(' ', ' ');
str.Replace(' ', '_');
str.TrimLeft('_');
str.TrimRight('_');
while (str.Replace("__", "_"));
return str;
}
然后把dll和lib复制到我要用这个dll的工程中,把lib文件名写到工程设置里
然后在调用这个DLL的时候
E:\作业\DllTest\DllTestView.cpp(63) : error C2653: 'CStrUse' : is not a class or namespace name
E:\作业\DllTest\DllTestView.cpp(63) : error C2065: 'StrRep' : undeclared identifier
我明明已经把lib写到工程设置里了。。
而且在我输CStrUse时,助手已经能够识别这个类,并且把这个类的成员函数自动列出来了。。为啥编绎不通过?
以上介绍了“ [求助]DLL初级问题”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/3363266.html

相关图片

相关文章