strmbase.lib(dllentry.obj) : error LNK2001: unresolved external symbol "class CFactoryTemplate * g_Templates" (?g_Templates@@3PAVCFactoryTemplate@@A)
strmbase.lib(dllentry.obj) : error LNK2001: unresolved external symbol "int g_cTemplates" (?g_cTemplates@@3HA)
strmbase.lib(dllentry.obj) : error LNK2001: unresolved external symbol "int g_cTemplates" (?g_cTemplates@@3HA)
解决方案 »
- vc 点运行(F5) 没反应 调试(F7)倒是可以的 怎么回事 重装了好几遍
- 全局数组问题~~~~~~~~~~~~~~~~~
- atl中如何操作控件
- 求教高手,怎样完成这个程序
- 已经知道了Windows用户的登陆名,用那个API能获得该用户的全名?
- 小弟初学atl,请问用atl开发了一个进程内dll,再做了个客户程序(.exe),如果把这两个文件拷到另一台机器上,能运行么?~~~~
- 怎样得到CDialogBar上的控件?如何响应放在CDialogBar上的控件的消息?应该在MainFrame里添代码,但我在OnCreate()中操作对象却还没生成
- 请教关于托盘的问题
- 请教关于CDoc/View
- C++将Access数据库中几十万条的数据导出至Excel文件
- 沒網卡﹐怎么調試網絡程序?up 有分
- 请问csdn中那个地方有源代码下载
help you to up
unresolved external symbol "symbol"Code will generate this error message if it references something (like a function, variable, or label) that the linker can’t find in all the libraries and object files it searches. In general, there are two reasons this error occurs: what the code asks for doesn’t exist (the symbol is spelled incorrectly or uses the wrong case, for example), or the code asks for the wrong thing (you are using mixed versions of the libraries?some from one version of the product, others from another version). Numerous kinds of coding and build errors can cause LNK2001. Several specific causes are listed below, and some have links to more detailed explanations. Coding Problems Mismatched case in your code or module-definition (.DEF) file can cause LNK2001. For example, if you named a variable “var1” in one C++ source file and tried to access it as “VAR1” in another, you would receive this error. The solution is to exactly match the case of the symbol in all references.
A project that uses function inlining yet defines the functions in a .CPP file rather than in the header file can cause LNK2001.
If you are using C++, make sure to use extern “C” when calling a C function from a C++ program. By using extern “C” you force the use of the C naming convention. Be aware of compiler switches like /Tp or /Tc that force a file to be compiled as a C (/Tc) or C++ (/Tp) file no matter what the filename extension, or you may get different function names than you expect.
Attempting to reference functions or data that don't have external linkage causes LNK2001. In C++, inline functions and const data have internal linkage unless explicitly specified as extern.
A missing function body or variable will cause LNK2001. Having just a function prototype or extern declaration will allow the compiler to continue without error, but the linker will not be able to resolve your call to an address or reference to a variable because there is no function code or variable space reserved.
Name decoration incorporates the parameters of a function into the final decorated function name. Calling a function with parameter types that do not match those in the function declaration may cause LNK2001.
Incorrectly included prototypes will cause the compiler to expect a function body that is not provided. If you have both a class and non-class implementation of a function F, beware of C++ scope-resolution rules.
When using C++, make sure that you include the implementation of a specific function for a class and not just a prototype in the class definition.
Attempting to call a pure virtual function from the constructor or destructor of an abstract base class will cause LNK2001 since by definition a pure virtual function has no base class implementation.
Only global functions and variables are public.
Functions declared with the static modifier by definition have file scope. Static variables have the same limitation. Trying to access any static variables from outside of the file in which they are declared can result in a compile error or LNK2001. A variable declared within a function (a local variable) can only be used within the scope of that function. C++ global constants have static linkage. This is different than C. If you try to use a global constant in C++ in multiple files you get error LNK2001. One alternative is to include the const initializations in a header file and include that header in your .CPP files when necessary, just as if it was a function prototype. Another alternative is to make the variable non-constant and use a constant reference when assessing it. Compiling and Linking Problems The names of the Microsoft run-time and MFC libraries needed at link time are included in the object file module by the Microsoft compiler. If you use the /NOD (/NODEFAULTLIB) option, these libraries will not be linked into the project unless you have explicitly included them. Using /NOD will cause error LNK2001 in this case.
If you are using Unicode and MFC, you will get an unresolved external on _WinMain@16 if you don’t create an entrypoint to wWinMainCRTStartup. Use the /ENTRY option or type this value in the Project Settings dialog box. (To find this option in the development environment, click Settings on the Project menu, then click the Link tab, and click Output in the Category box.) See Unicode Programming Summary. See the following Knowledge Base articles located in the Online Information System for more information. An easy way to reach an article is to copy a "Q" number above, open the Search dialog box from the Help menu and select the Query tab, then paste the number into the first text box and press ENTER.
Q125750 "PRB: Error LNK2001: '_WinMain@16': Unresolved External Symbol"
Q131204 "PRB: Wrong Project Selection Causes LNK2001 on _WinMain@16"
Q100639 "Unicode Support in the Microsoft Foundation Class Library"
Linking code compiled with /MT with the library LIBC.LIB causes LNK2001 on _beginthread, _beginthreadex, _endthread, and _endthreadex.
When compiling with /MD, a reference to "func" in your source becomes a reference "__imp__func" in the object since all the run-time is now held within a DLL. If you try to link with the static libraries LIBC.LIB or LIBCMT.LIB, you will get LNK2001 on __imp__func. If you try to link with MSVCxx.LIB when compiling without /MD you will not always get LNK2001, but you will likely have other problems.
Linking code compiled with an explicit or implicit /ML to the LIBCMT.LIB causes LNK2001 on _errno.
Linking with the release mode libraries when building a debug version of an application can cause LNK2001. Similarly, using an /Mxd option (/MLd, /MTd, or /MDd) and/or defining _DEBUG and then linking with the release libraries will give you potential unresolved externals (among other problems). Linking a release mode build with the debug libraries will also cause similar problems.
Mixing versions of Microsoft libraries and compiler products can be problematic. A new compiler version's libraries may contain new symbols that cannot be found in the libraries included with previous versions. Use DUMPBIN to find out if a symbol is in a 32-bit object file or library.
There is currently no standard for C++ naming between compiler vendors or even between different versions of a compiler. Therefore linking object files compiled with other compilers may not produce the same naming scheme and thus cause error LNK2001.
Mixing inline and non-inline compile options on different modules can cause LNK2001. If a C++ library is created with function inlining turned on (/Ob1 or /Ob2) but the corresponding header file describing the functions has inlining turned off (no inline keyword), you will get this error. To prevent this problem, have the inline functions defined with inline in the header file you are going to include in other files.
If you are using the #pragma inline_depth compiler directive, make sure you have a value of 2 or greater set, and make sure you are using the /Ob1 or /Ob2 compiler option.
Omitting the LINK option /NOENTRY when creating a resource-only DLL will cause LNK2001.
Using incorrect /SUBSYSTEM or /ENTRY settings can cause LNK2001. For example, if you write a character-based application (a console application) and specify /SUBSYSTEM:WINDOWS, you will get an unresolved external for WinMain. For more information on these options and entry points, see the /SUBSYSTEM and /ENTRY linker options.
Export Problems When you are porting an application from 16 to 32 bits, LNK2001 can occur. The current 32-bit module-definition (.DEF) file syntax requires that __cdecl, __stdcall, and __fastcall functions be listed in the EXPORTS section without underscores (undecorated). This differs from the 16-bit syntax, where they must be listed with underscores (decorated). For more information, see the description of the EXPORTS section of module-definition files.
Any export listed in the .DEF file and not found will cause LNK2001. This could be because it does not exist, is spelled incorrectly, or uses decorated names (.DEF files do not take decorated names).
This error message is followed by fatal error LNK1120.The following sections give more detailed information on some of the issues named in the above list. Missing function body or variable
Name decoration
The symbol is not public
Automatic (function scope) variables
Global constants in C++
Function inlining problems
2.或者你是用的是C编译的函数,但是没有加 extern "C"上面好的的一片 棉花糖 ,搂主慢慢看!
我是把我原来的一个类导入现在的控件工程中,相关链接和原来的一样.bluemoon能不能说点中文的,我的E文不好耶.谢谢大家,我继续调试
2. 解决办法:1) #pragma comment(lib, "strmbase.lib")
指示链接器连接abc.lib
2)roject->setting中Link->object/library modules加入strmbase.lib
2.或者你是用的是C编译的函数,但是没有加 extern "C"上面好的的一片 棉花糖 ,搂主慢慢看!
Setting Project Settings For Both Release and Debug Builds To set project settings for both release and debug builds, perform the following steps. From the Project menu, choose Settings.
In the dialog box that appears, select All Configurations in the Settings For drop-down list.
Follow these steps to set your project general settings: From the Project menu, choose Settings.
Choose the General tab.
From the Microsoft Foundation Classes drop-down list, select Not Using MFC.
Follow these steps to set your project compiler settings: From the Project menu, choose Settings.
Choose the C/C++ tab.
In the Category drop-down list, select General.
In the Preprocessor definitions text box, insert the following:
INC_OLE2,STRICT,WIN32,_MT,_DLL,_X86_=1,WINVER=0x0400
Select the C++ Language category.
Select the Enable exception handling check box.
Choose the Code Generation category.
In the Processor drop-down list, select Blend*.
In the Calling convention drop-down list, select _stdcall.
In the Use Run-time library drop-down list, select Multithreaded DLL.
Select the Precompiled Headers category.
Select the Not using precompiled headers option button.
Follow these steps to set your project link settings: From the Project menu, choose Settings.
Choose the Link tab.
In the Category drop-down list, select General.
In the Output file name text box, type the filter's output file name; for example, Debug/Filter.ax.
Add the following libraries to the beginning of the Object/Library modules text box.
quartz.lib strmbase.lib msvcrt.lib
These libraries must be the first libraries in the link list. Depending on the functions your application accesses, you might need to add other libraries to this list. Select the Ignore all default libraries check box.
Select the Customize category.
Clear the Use program database check box.
Select the Output category.
In the Base address text box, type:
0x1c400000In the Entry-point symbol text box, type:
DllEntryPoint@12Setting Project Settings for Debug Builds To set project settings for debug builds, perform the following steps. From the Project menu, choose Settings.
Select Win32 Debug in the Settings For drop-down list in the Project Settings dialog box that appears.
Choose the C/C++ tab.
In the Category drop-down list, select General.
Select the Generate browse info check box.
In the Debug info drop-down list, select C7 Compatible.
Select the Code Generation category.
In the Use Run-time library drop-down list, select Debug Multithreaded DLL.
Choose the Link tab.
Select the Debug category.
Select the Debug info check box.
Building a Release or Debug Version of Your Project To build a release or debug version of your project: Choose Set Active Configuration from the Build menu, and select Win32 Release or Win32 Debug from the list that appears.
Choose Build Filter.ax from the Build menu. The name Filter.ax is the name you gave the output file in the Link tab.
是加在我的头文件最上面吗?(#include"xxxx.h"那一块)我加上去后还是相同的错误,,#pragma comment(lib, "strmbase.lib")是作什么用的,请再说说
strmbase.lib(dllentry.obj) : error LNK2001: unresolved external symbol "int g_cTemplates" (?g_cTemplates@@3HA)从报错来看,应该是.lib里没有导出class CFactoryTemplate * g_Templates或导出的函数没有这样的变量或头文件里没有定义合理的变量,没有你的工程,很难猜想你的实际情况,试试吧!
int g_cTemplates;
编译就通过.但是用VB测试是就出现"Class not registered"
加在头文件里面指示链接器连接strmbase.libdll对应的lib文件是包含函数的地址信息等
static lib则还包含函数的实现代码,链接器会将需要的函数实现体全部复制到最终的exe内。
就是Link with strmbase..lib,与project->setting中Link中设置一样
你提的问题很容易解决,就是说起来很费事:P
我编译的.ocx已经注册了,我还要注册什么COM组建?能说的详细点嘛?
介与热心人比较多,100分可能不够分,搞定后可在追加!
extern "C"
{
#include "yourcontrol.h"
}
{
#include "yourcontrol.h"
}
不行,会出现Templates can not be declared to "C" linkage