带头文件见得动态链接库的有关问题(代码以清晰的列出)
带头文件见得动态链接库的问题(代码以清晰的列出)
下面是可执行模块的原文件,倒入一个DLL导出的符号,并在代码中引用了这些符号
#include"MyLib\MyLib.h"----------------问题出现在这,这个MyLib.h的文件压根不再可执行文件的
项目里面啊,怎么才能让他包含进来呢?
难道与vs2010附加包含目录和附加库目录有关?
------解决方案--------------------
添加了 MyLib.h 所在路径后
#include "MyLib.h"
或 #include <MyLib.h> 都可以
/****************MyLib.h**************************************/
//Indicate thar all function/varibles are being import
#define MYLIBAPI extern "C" _declspec(dllimport)
#endif
///////////////////////////
//Define exported varibles here.(NOTE:Avoid exporting varibles)
MYLIBAPI int g_nResult;
//Define exported function prototypes here
MYLIBAPI int Add(int nLeft,int nRight);
/************************MyLib.cpp*************************/
//include the standard windows and c-runtime header file here
#include <windows.h>
//This DLL source code file exports functions and variables
#define MULIBAPI extern "C" _declspec(dllexport)
#include "MyLib.h"
//Place the code for this DLL source code file here
int g_nResult;
int Add(int nLeft,int nRight)
{
g_nResult=nLeft+nRight;
return (g_nResult);
}
下面是可执行模块的原文件,倒入一个DLL导出的符号,并在代码中引用了这些符号
#include"MyLib\MyLib.h"----------------问题出现在这,这个MyLib.h的文件压根不再可执行文件的
项目里面啊,怎么才能让他包含进来呢?
难道与vs2010附加包含目录和附加库目录有关?
------解决方案--------------------
添加了 MyLib.h 所在路径后
#include "MyLib.h"
或 #include <MyLib.h> 都可以