Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You're exporting a class member function <code>void MyFuncLibInterface::myFunc(std::string param);</code> but trying to import a free function <code>void myFunc(std::string param);</code></p> <p>Make sure you <code>#define MyFuncLib_EXPORTS</code> in the DLL project. Make sure you <code>#include "MyFuncLibInterface.h"</code> in the console app <em>without</em> defining <code>MyFuncLib_EXPORTS</code>. </p> <p>The DLL project will see:</p> <pre><code>class __declspec(dllexport) MyFuncLibInterface { ... }: </code></pre> <p>And the console project will see:</p> <pre><code>class __declspec(dllimport) MyFuncLibInterface { ... }: </code></pre> <p>This allows your console project to use the class from the dll.</p> <p>EDIT: In response to comment</p> <pre><code>#ifndef FooH #define FooH #ifdef BUILDING_THE_DLL #define EXPORTED __declspec(dllexport) #else #define EXPORTED __declspec(dllimport) #endif class EXPORTED Foo { public: void bar(); }; #endif </code></pre> <p>In the project which actually implements <code>Foo::bar()</code> <code>BUILDING_THE_DLL</code> must be defined. In the project which tries to <em>use</em> <code>Foo</code>, <code>BUILDING_THE_DLL</code> should <em>not</em> be defined. <em>Both</em> projects must <code>#include "Foo.h"</code>, but only the DLL project should contain <code>"Foo.cpp"</code></p> <p>When you then build the DLL, the class Foo and all its members are marked as "exported from this DLL". When you build any other project, the class Foo and all its members are marked as "imported from a DLL"</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload