runningman那几期好看:使用VC++编写的dll文件中的错误

来源:百度文库 编辑:高校问答 时间:2024/05/11 03:43:53
在头文件中作了如下定义:
#ifdef test11_EXPORTS
#define test11_API __declspec(dllexport)
#else
#define test11_API __declspec(dllimport)
#endif
建立的是win32动态链接工程,然后编函数,如:
test11_API int GetFigure(BYTE * pBuffer, int BufferSize, unsigned long Y[],unsigned long U[],unsigned long V[]);

但是在编译的时候出错,错误类型为:
D:\test11\test11.cpp(27) : error C2491: 'GetFigure' : definition of dllimport function not allowed
哪位大虾知道错在哪里,急等答案!
处此之外还有其他的方法吗?我是找着别人的程序写的程序,他的并没有#define test11_EXPORTS ,却可以编译过去,这是为何??还可以在其他的地方#define test11_EXPORTS 吗?

dllimport是引入函数。如果要引入函数的话,必须有对应的.H和.LIB文件。如果是输出,则要在#ifdef test11_EXPORTS之前加上#define test11_EXPORTS