Note that there are some explanatory texts on larger screens.

plurals
  1. POAdded reference to .lib project - project not using .cpp file?
    text
    copied!<p>I am still reasonably new to C++ so forgive me if I have misunderstood something.</p> <p>I have a C++ library that contains sql connection classes, and I want to use it in a project. I have:</p> <ul> <li>Added it to the same solution</li> <li>Added a reference to it in "Framework and References"</li> <li>Included in the library's header file in stdafx.cpp of the main project</li> <li>Added the library project's directory as an include directory to the main project</li> </ul> <p>But when compiling the project I am still getting a number of <code>unresolved external symbol</code> errors.</p> <p><strong>If I include the library project's *.cpp file it works fine</strong>, but I didn't think you would have to do this.</p> <hr> <p>These are the exact errors I am getting:</p> <pre><code>2&gt;Link: 2&gt; sqlConnector.obj : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance 2&gt; Creating library .\Release\MainProject.lib and object .\Release\MainProject.exp 2&gt;LINK : warning LNK4098: defaultlib 'mfc100u.lib' conflicts with use of other libs; use /NODEFAULTLIB:library 2&gt;LINK : warning LNK4098: defaultlib 'mfcs100u.lib' conflicts with use of other libs; use /NODEFAULTLIB:library 2&gt;MainProject.obj : error LNK2001: unresolved external symbol "public: bool __thiscall SQLQuery::AddParameter(class ATL::CStringT&lt;char,class StrTraitMFC_DLL&lt;char,class ATL::ChTraitsCRT&lt;char&gt; &gt; &gt;)" (?AddParameter@SQLQuery@@QAE_NV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z) 2&gt;MainProject.obj : error LNK2001: unresolved external symbol "public: void __thiscall SQLQuery::SetQuery(class ATL::CStringT&lt;char,class StrTraitMFC_DLL&lt;char,class ATL::ChTraitsCRT&lt;char&gt; &gt; &gt;)" (?SetQuery@SQLQuery@@QAEXV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z) 2&gt;MainProject.obj : error LNK2001: unresolved external symbol "public: bool __thiscall SQLQuery::Open(class ATL::CStringT&lt;char,class StrTraitMFC_DLL&lt;char,class ATL::ChTraitsCRT&lt;char&gt; &gt; &gt;)" (?Open@SQLQuery@@QAE_NV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z) 2&gt;MainProject.obj : error LNK2001: unresolved external symbol "public: void __thiscall SQLQuery::SetConnectionString(class ATL::CStringT&lt;char,class StrTraitMFC_DLL&lt;char,class ATL::ChTraitsCRT&lt;char&gt; &gt; &gt;)" (?SetConnectionString@SQLQuery@@QAEXV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z) 2&gt;sqlConnector.obj : error LNK2001: unresolved external symbol "public: void __thiscall CAMTrace::SetEXEName(wchar_t const *)" (?SetEXEName@CAMTrace@@QAEXPB_W@Z) 2&gt;sqlConnector.obj : error LNK2001: unresolved external symbol "public: void __thiscall CAMTrace::Trace(wchar_t const *,int,int)" (?Trace@CAMTrace@@QAEXPB_WHH@Z) 2&gt;.\Release\MainProject.exe : fatal error LNK1120: 6 unresolved externals </code></pre>
 

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