I created a C++ solution full of WIN32 console application projects in the following form:
Each projects contains .cpp and .h files and in Forms there is only main.cpp which includes the include lines for all .h files.
When trying to bulid even a single project i get LNK2019 - unresolved external symbol which seems to appear for each project when i try to compile from main.
I read many questions about it and i tried to deal with additional dependencies or Build order but nothing seems to make any difference.
I'm attaching the errors here for a single project (Button) - I guess that once i figure the issue with one project the rest will be same.
Error 1 error LNK2019: unresolved external symbol "public: void __thiscall Graphics::clearScreen(void)" (?clearScreen@Graphics@@QAEXXZ) referenced in function "public: virtual void __thiscall Button::keyDown(int,char)" (?keyDown@Button@@UAEXHD@Z) D:\Forms\Button\Button.obj Button
Error 2 error LNK2019: unresolved external symbol "public: void __thiscall Graphics::setBackground(enum Color)" (?setBackground@Graphics@@QAEXW4Color@@@Z) referenced in function "public: virtual void __thiscall Button::draw(class Graphics,int,int,unsigned int)" (?draw@Button@@UAEXVGraphics@@HHI@Z) D:\Forms\Button\Button.obj Button
Error 3 error LNK2019: unresolved external symbol "public: void __thiscall Graphics::setForeground(enum Color)" (?setForeground@Graphics@@QAEXW4Color@@@Z) referenced in function "public: virtual void __thiscall Button::draw(class Graphics,int,int,unsigned int)" (?draw@Button@@UAEXVGraphics@@HHI@Z) D:\Forms\Button\Button.obj Button
Error 4 error LNK2019: unresolved external symbol "public: void __thiscall Graphics::write(int,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?write@Graphics@@QAEXHHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual void __thiscall Button::draw(class Graphics,int,int,unsigned int)" (?draw@Button@@UAEXVGraphics@@HHI@Z) D:\Forms\Button\Button.obj Button
Error 5 error LNK2019: unresolved external symbol "public: __thiscall Control::Control(void)" (??0Control@@QAE@XZ) referenced in function "public: __thiscall Button::Button(int)" (??0Button@@QAE@H@Z) D:\Forms\Button\Button.obj Button
Error 6 error LNK2019: unresolved external symbol "public: __thiscall Control::~Control(void)" (??1Control@@QAE@XZ) referenced in function __unwindfunclet$??0Button@@QAE@H@Z$0 D:\Forms\Button\Button.obj Button
Error 7 error LNK2001: unresolved external symbol "public: virtual void __thiscall Control::getAllControls(class std::vector<class Control *,class std::allocator<class Control *> > *)" (?getAllControls@Control@@UAEXPAV?$vector@PAVControl@@V?$allocator@PAVControl@@@std@@@std@@@Z) D:\Forms\Button\Button.obj Button
Error 8 error LNK2001: unresolved external symbol "public: virtual void __thiscall Control::setWidth(int)" (?setWidth@Control@@UAEXH@Z) D:\Forms\Button\Button.obj Button
Error 9 error LNK2001: unresolved external symbol "public: virtual void __thiscall Control::setValue(int)" (?setValue@Control@@UAEXH@Z) D:\Forms\Button\Button.obj Button
Error 10 error LNK2001: unresolved external symbol "public: virtual void __thiscall Control::SetForeground(enum Color)" (?SetForeground@Control@@UAEXW4Color@@@Z) D:\Forms\Button\Button.obj Button
Error 11 error LNK2001: unresolved external symbol "public: virtual void __thiscall Control::SetBackground(enum Color)" (?SetBackground@Control@@UAEXW4Color@@@Z) D:\Forms\Button\Button.obj Button
Error 12 error LNK2019: unresolved external symbol "public: void __thiscall Control::drawBackground(void)" (?drawBackground@Control@@QAEXXZ) referenced in function "public: virtual void __thiscall Button::draw(class Graphics,int,int,unsigned int)" (?draw@Button@@UAEXVGraphics@@HHI@Z) D:\Forms\Button\Button.obj Button
Error 13 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup D:\Forms\Button\MSVCRTD.lib(crtexe.obj) Button
Error 14 error LNK1120: 13 unresolved externals D:\Forms\Debug\Button.exe Button
The .h files paths are correct and i can see all options in the intellisense.
I would appriciate any idea which might help me resolve this issue. Thanks
So if I understood correctly you have only one project with a main?
If that's right then try to build all your other projects as static libraries (.lib)(or shared libraies (.dll)) and reference them into your main project (Forms) it should be working.
Right now you are trying to build an executable (.exe) from 12other .exe. It can't work.