简体   繁体   English

xDispatch LNK2019 链接器错误未解析的外部

[英]xDispatch LNK2019 Linker error Unresolved Externals

I realise this i mighty popular question, but all of the other posts seem to follow the same idea.我意识到这是一个非常受欢迎的问题,但所有其他帖子似乎都遵循相同的想法。 That the include, lib and bin folder need to be correctly configured.需要正确配置 include、lib 和 bin 文件夹。 I believe my settings are correct, but i am still getting the LNK2019 error.我相信我的设置是正确的,但我仍然收到 LNK2019 错误。 What am i doing wrong?我究竟做错了什么?

Using Visual Studio 2012使用 Visual Studio 2012

I am getting the infamous LNK2019 error.我收到了臭名昭著的 LNK2019 错误。 Many posts of this issue seem to think it is a linker issue.这个问题的许多帖子似乎认为这是一个链接器问题。 I am using a library with lib and dll files.我正在使用带有 lib 和 dll 文件的库。 The project folder has an include, bin and lib folder that need to be configured in the project.项目文件夹中有一个include、bin和lib文件夹,需要在项目中进行配置。

Install instructions are here..... http://opensource.mlba-team.de/xdispatch/docs/current/tutorial.html安装说明在这里..... http://opensource.mlba-team.de/xdispatch/docs/current/tutorial.html

However, this is clearly a linker issue as it occurs in other libraries of a similar type.但是,这显然是链接器问题,因为它发生在其他类似类型的库中。 I have followed the instructions for other posts and i'm still a bit lost.我已按照其他帖子的说明进行操作,但仍然有点迷茫。 I believe this should be correct, but i have tried virtually every possible combination.我相信这应该是正确的,但我已经尝试了几乎所有可能的组合。 Don't get it.不要明白。

My Project Configurations我的项目配置

C++ -> General -> Additional Include Directories. C++ -> 常规 -> 附加包含目录。 C:\\Users\\Daniel\\Documents\\Visual Studio 2012\\Projects\\LibDispatchTest\\xdispatch_0.7.2_Visual Studio 10_i386\\include;%(AdditionalIncludeDirectories) C:\\Users\\Daniel\\Documents\\Visual Studio 2012\\Projects\\LibDispatchTest\\xdispatch_0.7.2_Visual Studio 10_i386\\include;%(AdditionalIncludeDirectories)

Linker -> General -> Additional Library Directories C:\\Users\\Daniel\\Documents\\Visual Studio 2012\\Projects\\LibDispatchTest\\xdispatch_0.7.2_Visual Studio 10_i386\\lib;%(AdditionalLibraryDirectories)链接器 -> 常规 -> 附加库目录C:\\Users\\Daniel\\Documents\\Visual Studio 2012\\Projects\\LibDispatchTest\\xdispatch_0.7.2_Visual Studio 10_i386\\lib;%(AdditionalLibraryDirectories)

Linker -> Input -> Additional Dependancies: .....uuid.lib;odbc32.lib;odbccp32.lib;xdispatch.lib;%(AdditionalDependencies)链接器 -> 输入 -> 附加依赖项: .....uuid.lib;odbc32.lib;odbccp32.lib;xdispatch.lib;%(AdditionalDependencies)

Environment Variables.环境变量。

I have the PATH variable set.我设置了 PATH 变量。

C:\\Chocolatey\\bin;C:\\Users\\Daniel\\Documents\\Visual Studio 2012\\Projects\\VisionBase\\xdispatch_0.7.2_Visual Studio 10_i386\\bin; C:\\Chocolatey\\bin;C:\\Users\\Daniel\\Documents\\Visual Studio 2012\\Projects\\VisionBase\\xdispatch_0.7.2_Visual Studio 10_i386\\bin;

The error messages are:错误消息是:

error LNK2019: unresolved external symbol "_declspec(dllimport) public: void __thiscall xdispatch::queue::async(class std::function<void __cdecl(void)> const &)" (__imp?async@queue@xdispatch@@QAEXABV?$function@$$A6AXXZ@std@@@Z) referenced in function "void __cdecl some_function(void)" (?some_function@@YAXXZ)   c:\Users\Daniel\documents\visual studio 2012\Projects\LibDispatchTest\LibDispatchTest\main.obj  LibDispatchTest 

error LNK1120: 1 unresolved externals   c:\users\daniel\documents\visual studio 2012\Projects\LibDispatchTest\Debug\LibDispatchTest.exe 1   1   LibDispatchTest

Seriously, am totally lost and i do not see what i am doing wrong here.说真的,我完全迷失了,我不明白我在这里做错了什么。

EDIT 1编辑 1

This is similar to a sample from the above link, but modified to just couNT 1000000^2 and print some stuff.这类似于上面链接中的示例,但修改为仅 couNT 1000000^2 并打印一些内容。 We just want to be able to compile and run this sample and i can correct my larger project exhibiting this issue.我们只是希望能够编译和运行此示例,并且我可以更正出现此问题的较大项目。 This project was made fresh with the simplest code that is representative of what i need to get working.这个项目是用最简单的代码重新制作的,这些代码代表了我需要工作的内容。 Both this sample and my other project have this problem and produce the same error.此示例和我的其他项目都有此问题并产生相同的错误。

#include <xdispatch/dispatch>
#include <vector>
#include <cmath>

class SomeData {    
public:      
std::vector<double> a;   
std::vector<double> b;   
std::vector<double> c;   
std::vector<double> results;  
};

void do_calculations(SomeData* sd){

       // our output will go in here
       sd->results = std::vector<double>(sd->a.size());

       // the calculation - running on one thread only
       for(unsigned int i = 0; i < 1000000; i++){
              sd->results[i] = 0;
              for(unsigned int j = 0; j < 10000000; j++){
                     for(unsigned int z = 0; z < sd->c.size(); z++){
                            std::cout << i << " " << j << std::endl;
                     }
              }
       } }

/*  This function is getting called  from your main thread also powering  the user interface  */ 

void some_function() {
           SomeData* sd = new SomeData();       
           xdispatch::global_queue().async(${

                  // execute the heavy code
                  do_calculations(sd);
           }); } 

int main() {    
some_function();
    return 0; }

Is anyone able to help?有人可以帮忙吗?

The binaries you used where built with and for MS Visual Studio 2010. Since then the CRT has changed quite a bit and might not be compatible, especially when parts of the STL is used.您使用的二进制文件是用 MS Visual Studio 2010 构建的。从那时起,CRT 发生了很大变化,可能不兼容,尤其是在使用部分 STL 时。 Because of that I do not recommend to ever use a C++ dll built with VS 2010 for use in VS 2012 or later.因此,我不建议在 VS 2012 或更高版本中使用使用 VS 2010 构建的 C++ dll。 It could be that building and linking succeeds but during runtime you experience weird and unexpected issues.可能是构建和链接成功,但在运行时您会遇到奇怪和意外的问题。 In your case even linking won't work because std::function has changed its signature in the meantime, so lucky enough you already discover those incompatibilities at compile time.在您的情况下,即使链接也不起作用,因为 std::function 同时更改了其签名,所以幸运的是您已经在编译时发现了这些不兼容性。

I assume xdispatch will work just fine with VS2012 and maybe even VS2013, however you will need to do your own build for that.我认为 xdispatch 可以在 VS2012 甚至 VS2013 上正常工作,但是您需要为此进行自己的构建。 All information needed is summarized at [1].所需的所有信息都在 [1] 中进行了总结。 A tarball containing the sources can always be found at [2].包含源代码的 tarball 总是可以在 [2] 中找到。

[1] http://opensource.mlba-team.de/xdispatch/docs/current/requirements.html [1] http://opensource.mlba-team.de/xdispatch/docs/current/requirements.html
[2] http://opensource.mlba-team.de/xdispatch/files/ [2] http://opensource.mlba-team.de/xdispatch/files/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2013错误LNK1120:1未解决的外部和错误LNK2019:未解决的外部符号 - visual studio 2013 error LNK1120: 1 unresolved externals and error LNK2019: unresolved external symbol “错误LNK2019:未解决的外部致命故障”和“错误LNK1120:1未解决的外部致命故障” - “error LNK2019: unresolved external fatal” and “error LNK1120: 1 unresolved externals” 错误LNK2019:未解决的外部和LNK1120:1未解决的外部 - error LNK2019: unresolved external and LNK1120: 1 unresolved externals 链接器错误LNK2019 - Linker Error LNK2019 链接器错误LNK2019? - Linker error LNK2019? Qt错误:LNK1120:1未解析的externals main.obj:-1:错误:LNK2019运行Qmake - Qt error: LNK1120: 1 unresolved externals main.obj:-1: error: LNK2019 Run Qmake C ++错误LNK2019 &amp;&amp;致命错误LNK1120:1个未解析的外部 - C++ error LNK2019 && fatal error LNK1120: 1 unresolved externals 错误LNK2019和致命错误LNK1120:2个未解决的外部 - Error LNK2019 and Fatal error LNK1120: 2 unresolved externals 错误LNK2019:函数___tmainCRTStartup和错误2中引用了未解析的外部符号_main错误LNK1120:1个未解析的外部 - error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup and Error 2 error LNK1120: 1 unresolved externals 由于未解析的外部因素,OpenCV将无法编译 - LNK2019 - OpenCV won't compile due to unresolved externals — LNK2019
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM