关于"testencodefile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public"
2007-06-07 14:01
483 查看
这个link错误是在调用DLL出现的。主要原里是什么呢?
查阅相关资料,知。
通常情况下,我们的编译器编译通过,但不能Link,多半是MSDN里提到:).
说说我的情况吧,这主要是因为没有把LIB库加入到编译选项中。
静态调用DLL库的方法:
1、编写好DLL。
2、把DLL库拷贝到当前工程目录下,或拷贝到系统目录下。例如:c:/windows|system32下面。
3、把步骤1生成的LIB库拷贝到当前工程目录下或系统目录下例如:c:/windows|system32下面。
4、把步骤1生成的.H文件拷贝到当前工程目录下。例如:c:/windows|system32下面。
5、在VC++的IDE环境下,Alt+F7(或Project->Setting),选择“Link”标签 页,在Object/LibraryModules栏内输入LIB库 名字。
其实整个过程就如同我们创建的工程,调用WINDOWS提供的API函数一下。所有的API函数通过DLL提供,我们调用某一个具体的函数时,先包含.H文件,在我们的"LINK"标签页内,VC++根据一些选项,在Object/LibraryModules内忆经写好了一些LIB库名。例如:GDI32.LIB,等等。
动态调用就简单了:
1、写好DLL
2、把DLL拷贝到系统目录,或是当前工程目录。(可省略)
3、显示用LoadLIbrary("Filename.dll")。若省略了第二步,则"FileName.dll"必须是绝对路径。例如:"c://dll/file.dll"
4、完成。
查阅相关资料,知。
通常情况下,我们的编译器编译通过,但不能Link,多半是MSDN里提到:).
说说我的情况吧,这主要是因为没有把LIB库加入到编译选项中。
静态调用DLL库的方法:
1、编写好DLL。
2、把DLL库拷贝到当前工程目录下,或拷贝到系统目录下。例如:c:/windows|system32下面。
3、把步骤1生成的LIB库拷贝到当前工程目录下或系统目录下例如:c:/windows|system32下面。
4、把步骤1生成的.H文件拷贝到当前工程目录下。例如:c:/windows|system32下面。
5、在VC++的IDE环境下,Alt+F7(或Project->Setting),选择“Link”标签 页,在Object/LibraryModules栏内输入LIB库 名字。
其实整个过程就如同我们创建的工程,调用WINDOWS提供的API函数一下。所有的API函数通过DLL提供,我们调用某一个具体的函数时,先包含.H文件,在我们的"LINK"标签页内,VC++根据一些选项,在Object/LibraryModules内忆经写好了一些LIB库名。例如:GDI32.LIB,等等。
动态调用就简单了:
1、写好DLL
2、把DLL拷贝到系统目录,或是当前工程目录。(可省略)
3、显示用LoadLIbrary("Filename.dll")。若省略了第二步,则"FileName.dll"必须是绝对路径。例如:"c://dll/file.dll"
4、完成。
相关文章推荐
- 关于error LNK2001: unresolved external symbol "__declspec(dllimport) public
- error LNK2001: unresolved external symbol "__declspec(dllimport) public:
- xx.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 错误
- VS2008 与Qt编程 出现.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall问题
- error LNK2001: unresolved external symbol "__declspec(dllimport) const CNoteMgr::`vftable'"
- LINK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string的解决方案
- error LNK2001: unresolved external symbol "__declspec(dllimport) class
- Google glog error LNK2001: unresolved external symbol "__declspec(dllimport) int fLI::FLAGS_XXXX 错误的
- error LNK2001: unresolved external symbol "public: virtual enum TCPSError
- error LNK2001: unresolved external symbol \"public: __thiscall。。。
- error LNK2001: unresolved external symbol "public: __thiscall CWinAppEx::CWinAppEx(int)" (??0CWinApp
- error LNK2001: unresolved external symbol "public: __thiscall
- error LNK2001: unresolved external symbol "__declspec(dllimport) const CNoteMgr::`vftable'"
- error LNK2001: unresolved external symbol "void __cdecl av_close_input_file(struct AVFormatContext *
- error LNK2019: unresolved external symbol "__declspec(dllimport) const CReadUserInfo::`vftable'" (__
- 关于 error LNK2001: unresolved external symbol "public: static class CString 错误处理
- 错误提示:error LNK2001: unresolved external symbol "public: static int person::weight" (?weight@person@@
- unresolved external symbol "__declspec(dllimport) int __stdcall
- error LNK2001: unresolved external symbol "public: static ... 解决一法
- 错误:error LNK2001: unresolved external symbol "public: __thiscall