读书人

请教在MFC中,要使用自己的头文件,应该

发布时间: 2012-02-27 10:00:22 作者: rapoo

请问在MFC中,要使用自己的头文件,应该如何设置?
假设我用头文件声明了2个全局函数

例如头文件名为test.h
void a();
void b();

然后在CPP中
#include "test.h "
#include "stdafx.h "
void a()
{}
void b()
{}

最后在要使用该头文件函数的头文件中包含test.h
但是在使用时,使用第一个函数没出现错误
使用第二个错误时,就出现了

error LNK2001: unresolved external symbol "bool __cdecl CheckFormat(class CString const &,class CString &) " (?CheckFormat@@YA_NABVCString@@AAV1@@Z)

这样的错误.

请问是什么原因?
在MFC中,使用自己的头文件有什么需要注意的?

[解决办法]
#include "test.h "
#include "stdafx.h "
调换顺序---》
#include "stdafx.h "
#include "test.h "

读书人网 >VC/MFC

热点推荐