在vs2008中添加lib文件以及一些常用项目设置选项

下面以添加ws2_32.lib文件为例

方法一(直接添加代码):

直接在.cpp文件中,添加#pragma comment(lib, "ws2_32.lib");即可。(ws2_32.lib即为你要添加的lib文件)

 

方法二(在vs工具栏中添加):

1.项目(project) -> TcpSrv属性(TcpSrv properties) (其中TcpSrv为工程名)

属性

 

 

2.打开TcpSrv属性页后,配置属性 -> 链接器(linker) -> 输入(Input) ,在附加依赖项 (AddITional dependences)中输入ws2_32.lib即可。

属性页

 

PS:括号内英文部分为英文版vs2008

 

 

 

 

【Configuration Properties】

  General-> 【Output Directory】  .../../output/debug 表示生成文件的输出路径

  General->【Intermediate Directory】.WsIuCsParser___Win32_Debug表示生成的中间路径

 Debugging->【Command】../../output/debug/TMPlatformConsole.exe表示此工程为Dll,TMPlatformConsole.exe会调用这个dll,并且可以在Dll中添加断点

Debugging->【Working Directory】../../output/debug,设置工作的路径

【c/c++】

General-> 【Additonal Include Directories】./include/epan,./include/glib,./include,./include/decode表示此工程所依赖的文件所在路径

Precompiled headers->【Precompiled Header File】.WsIuCsParser___Win32_Debug/WsIuCsParser.pch

预编译头文件

Output Files->【ASM List Name】.WsIuCsParser___Win32_Debug/

Output Files->【Object File Name】.WsIuCsParser___Win32_Debug/

Output Files->【Program Database File Name】.WsIuCsParser___Win32_Debug/

【Linker】

 General->【Output File】../../output/debug/WsIuCsParser.dll,定义输出文件路径及名称

General->【Additional Library Directories】./lib 依赖lib路径

Input->【Additional Dependencies】 glib-2.0.lib gmodule.lib  依赖的lib文件

Input->【Module Definition File】./ws_IuCs.def,定义要导出函数的文件,如果要导出函数,这是必须定义的

定义格式:

LIBRARY WsIuCsParser
DESCRIPTION "WsIuCsParser DLL" 
EXPORTS 
InitWsParserIuCs    @1 
DeInitWsParserIuCs   @2
WsIuCsParse       @3

Debugging-> 【Generate Program Database File】.../../output/debug/WsIuCsParser.pdb

Advanced->【Import  Library】.../../output/debug/WsIuCsParser.lib

 

posted @ 2014-08-08 15:40  Zucc_zt  阅读(427)  评论(0编辑  收藏  举报