Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ DLL linker error
    text
    copied!<p>I want to write a dll for an api of a device. since i am new to dlls i wanted to implement it on a simple text editor and then make one for the api. I have made header file and cpp file but when i run the code i get error lnk2001 followed by lnk1120 which is unresolved external error.</p> <p>I really have no idea where did i make a mistake, as far as i see i did it the right way. i was wondering if you guys could help me out. tnx.</p> <p>here is my header file</p> <pre><code>// EditFuncsDll.h #include &lt;cstdio&gt; #include &lt;vector&gt; #include &lt;string&gt; namespace EditFuncs { class MyEditFuncs { private: static std::vector&lt;std::string&gt; MyTextBox; public: static __declspec(dllexport) void Load(std::string command); static __declspec(dllexport) void Save(std::string command); static __declspec(dllexport) int Lines(); static __declspec(dllexport) void Add(std::string command); static __declspec(dllexport) void Remove(std::string command); static __declspec(dllexport) void Insert(std::string command); static __declspec(dllexport) int wc(std::string command); static __declspec(dllexport) void GetInfo(); }; } </code></pre> <p>and in my cpp file i just define the functions i declared in header file.</p> <p>and these are the errors i get</p> <blockquote> <p>Error 25 error LNK2001: unresolved external symbol "private: static class std::vector,class std::allocator >,class std::allocator,class std::allocator > > > EditFuncs::MyEditFuncs::MyTextBox" (?MyTextBox@MyEditFuncs@EditFuncs@@0V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@A) C:\Users\Lucy\Desktop\Erfan\Text_Editor_DLL\Text_Editor_DLL\EditFuncsDll.obj Text_Editor_DLL</p> </blockquote> <p>and</p> <blockquote> <p>Error 26 error LNK1120: 1 unresolved externals C:\Users\Lucy\Desktop\Erfan\Text_Editor_DLL\Debug\Text_Editor_DLL.dll Text_Editor_DLL</p> </blockquote>
 

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