Hi folks, First time poster, but I hope you can help me out. I'm trying to implement a DLL that makes use of the tbb flo graph, however every time I try and include the library from ANYWHERE other than the dllmain file, I get a linkererrors. Note: somewhere through the include chain the flow graph header file is included in dllmain. E.g. some object includes the flow graph, which is included by another, which is in tern included in the dllmain function file. If there is not an include chain between the file including the flow graph and the dllmain function file, then there are no compile problems. I can successfully include the flow graph among the exported functions, classes and variables etc. Here are the link errors:
Error 3 error LNK1169: one or more multiply defined symbols found C:Usersq285032DesktopdfsadgsaasdgasdgDebugdfsadgsaasdgasdg.dll 1 Error 1 error LNK2005: "private: void __thiscall tbb::flow::interface6::graph::register_node(class tbb::flow::interface6::graph_node *)" (?register_node@graph@interface6@flow@tbb@@AAEXPAVgraph_node@234@@Z) already defined in dllmain.obj C:Usersq285032Desktopdfsadgsaasdgasdgdfsadgsaasdgasdgstdafx.obj Error 2 error LNK2005: "private: void __thiscall tbb::flow::interface6::graph::remove_node(class tbb::flow::interface6::graph_node *)" (?remove_node@graph@interface6@flow@tbb@@AAEXPAVgraph_node@234@@Z) already defined in dllmain.obj C:Usersq285032Desktopdfsadgsaasdgasdgdfsadgsaasdgasdgstdafx.objI am able to include other tbb headers like tbb.h and atomic.h etc. I've been able to reproduce this with no problems using a Visual Studio 2010 wizrd produced dll project with no changes other than adding the #include "tbb\\flow_graph.h" statement (I've also tried it in the form#include and get the same results). Steps to reproduce: Open Visual Studio 2010, create a new C++ win32 console application using the wizard, making sure you select the "DLL" radio button and tick the "Export Symbols" check box - don't change any other settings. Hit finish. Set up the include and librarie dependencies to point to the TBB libraries - I've been using the Visual Studio add-on available on the website - but I've also tried it manually and had the same problem. Now add the statement#include "tbb\\flow_graph.h" to the file "stdafx.h" and compile the project. You should get a few link errors similar to mine. If you move the statement to the "dllmain.cpp" file it will compile without problem. Also if you place it in the API export classes it will compile without problems. I'm using the latest commercially aligned version -tbb40_297ossfromhttp://threadingbuildingblocks.org I've got no clue how to fix this and I'm in desperate need of it flow graph functionality. I've tried all the ways I can think of to debug this but reproducing it in a blank project is worrying. ANY help/fixes/workarounds will be greatly appreciated! Thanks!




