Note that there are some explanatory texts on larger screens.

plurals
  1. POLinker error LNK2019?
    primarykey
    data
    text
    <p>I have the following files</p> <p>file1_moduleA.hpp</p> <p>file1_moduleA.cpp</p> <p>sharedFile.hpp</p> <p>file1_moduleB.cpp</p> <pre><code>//sharedFile.hpp extern CustomClass *doSomething(CustomClass *var1, const char *var2); extern CustomClass *doSomethingElse(const char *var1); template &lt;class MYCLASS_A&gt; void myFunction(CustomClass *var1, const char* var2){ assert(somthing); if (condition){ new (MYCLASS_A); } } //file1_moduleA.cpp #include "sharedFile.hpp" // Contains the definitions of doSomething and doSomethingElse among others //file1_moduleA.hpp // Other declarations //file1_moduleB.cpp #include"sharedFile.hpp" //...SNIPPETS OF CODE void someFunction(CustomClass* var1){ doSomething(var1, "FOO"); } //... </code></pre> <p>The following are in one Visual Studio Project, Project A: file1_moduleA.hpp, file1_moduleA.cpp and sharedFile.hpp</p> <p>The following are in another VS Project, Project B: file1_moduleB.cpp, file1_moduleB.hpp</p> <p>Project A compiles and links perfectly, whereas Project B compiles but gives an unresolved symbol for <strong>CustomClass *doSomething(CustomClass *var1, const char *var2)</strong> at <strong>someFunction in file1_moduleB.cpp</strong></p> <p>I have tried <strong>defining</strong> the function with and without extern; tried using a separate file for the template in file1_moduleA.hpp; tried inducing dependency between ProjectB and ProjectA in VS, but nothing seems to work. I am unsure why the definition is not being found during linking. ProjectA.lib however, is being created.</p> <p>Any help in this regard would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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