使用记事本访问库 [英] Access Library with Notepad

查看:87
本文介绍了使用记事本访问库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Windows中的记事本访问C语言中的库?谢谢.
DS


将标题更改为使用记事本访问库"更合适(从使用记事本创建库").
[/EDIT]

How do you access a Library in C using notepad in windows? Thank you.
DS


Changed title to "access library with notepad" which is more appropriate (from "create library with notepad").
[/EDIT]

推荐答案

如果您在源代码中包含库,则必须在源代码中包含标头(无论您在何处使用它) )(如果pcap.h位于默认"目录中,则只需使用#include <pcap.h>;如果pcap.h与要写入的文件位于同一目录中,则可以使用#include "pcap.h"),或者使用#include "..\\winpcap\\pcap.h"指定整个目录路径. br/>
现在,我所讨论的只是将库头添加到项目中进行编译的参考.下一步是添加.lib文件进行链接.如果使用的是IDE,则只需将其添加到依赖项列表中,或者可以在其中一个头文件中使用#pragma comment(lib, "winpcap.lib")语句.

这样,您正在创建对DLL的依赖关系,因此您可能需要将该DLL与可执行文件放在同一目录中,以使一切正常运行.

您正在使用什么编译器?我想象是gcc还是g ++?
If you''re including a library in your source code, you must include the header in your source code (wherever you happen to use it) simply using a #include <pcap.h> if pcap.h is in a "default" directory or use #include "pcap.h" if its in the same directory as the file you''re writing, or specify the whole directory path using #include "..\\winpcap\\pcap.h".

Now all I''ve talked about has been in reference to adding the library header to your project for compilation. Next step is adding the .lib file for linking. If you''re using an IDE, this is simply added to the list of dependencies, or you can use a #pragma comment(lib, "winpcap.lib") statement in one of your header files.

By doing this, you''re creating a dependency to a DLL, so you''ll probably need to have the DLL in the same directory as your executable for everything to function correctly.

What compiler are you using? I imagine gcc or g++?


这篇关于使用记事本访问库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆