I'm trying to build a solution in Visual Studio 2017. And I get these errors:
1>------ Build started: Project: UA_Parser, Configuration: Release x64 ------
1>UaParserTest.cpp
1>UaParser.obj : error LNK2001: unresolved external symbol "class YAML::Node __cdecl YAML::LoadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?LoadFile#YAML##YA?AVNode#1#AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl YAML::InvalidNode::~InvalidNode(void)" (??1InvalidNode#YAML##UEAA#XZ)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl YAML::Exception::~Exception(void)" (??1Exception#YAML##UEAA#XZ)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl YAML::RepresentationException::~RepresentationException(void)" (??1RepresentationException#YAML##UEAA#XZ)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl YAML::BadConversion::~BadConversion(void)" (??1BadConversion#YAML##UEAA#XZ)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl YAML::BadSubscript::~BadSubscript(void)" (??1BadSubscript#YAML##UEAA#XZ)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: class YAML::detail::node & __cdecl YAML::detail::memory::create_node(void)" (?create_node#memory#detail#YAML##QEAAAEAVnode#23#XZ)
1>UaParser.obj : error LNK2001: unresolved external symbol "private: void __cdecl YAML::detail::node_data::convert_to_map(class std::shared_ptr<class YAML::detail::memory_holder>)" (?convert_to_map#node_data#detail#YAML##AEAAXV?$shared_ptr#Vmemory_holder#detail#YAML###std###Z)
1>UaParser.obj : error LNK2001: unresolved external symbol "private: void __cdecl YAML::detail::node_data::insert_map_pair(class YAML::detail::node &,class YAML::detail::node &)" (?insert_map_pair#node_data#detail#YAML##AEAAXAEAVnode#23#0#Z)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: class YAML::detail::node_iterator_base<class YAML::detail::node> __cdecl YAML::detail::node_data::end(void)" (?end#node_data#detail#YAML##QEAA?AV?$node_iterator_base#Vnode#detail#YAML###23#XZ)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: class YAML::detail::node_iterator_base<class YAML::detail::node> __cdecl YAML::detail::node_data::begin(void)" (?begin#node_data#detail#YAML##QEAA?AV?$node_iterator_base#Vnode#detail#YAML###23#XZ)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: void __cdecl YAML::detail::node_data::set_scalar(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?set_scalar#node_data#detail#YAML##QEAAXAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: void __cdecl YAML::detail::node_data::set_null(void)" (?set_null#node_data#detail#YAML##QEAAXXZ)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: void __cdecl YAML::detail::node_data::mark_defined(void)" (?mark_defined#node_data#detail#YAML##QEAAXXZ)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > YAML::detail::node_data::empty_scalar" (?empty_scalar#node_data#detail#YAML##2V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##A)
1>UaParser.obj : error LNK2001: unresolved external symbol "public: void __cdecl YAML::detail::memory_holder::merge(class YAML::detail::memory_holder &)" (?merge#memory_holder#detail#YAML##QEAAXAEAV123##Z)
1>C:\bmetric\C++ Projects\UA_Parser\x64\Release\UA_Parser.exe : fatal error LNK1120: 16 unresolved externals
1>Done building project "UA_Parser.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have a feeling they can be solved by linking, but I am not sure what to link (the precise folder).
So far, I have built the yaml-cpp as described on github. Also, I have added the ..\yaml-cpp\include folder in the Additional Include Directories from Configuration Properties >> C/C++ >> General and tried to include in the Additional Library Directories (Linker) various folders, unsuccessfully.
Never used YAML before. And I don't link stuff often.
I was getting the unresolved external symbols errors because I was including #include <yaml-cpp/node/node.h>, which is what Resharper recommended me(and it's is correct 99.9% of the time). In this case it's a wrong header and what I should have been including is: #include <yaml-cpp/yaml.h>.
I fixed my includes in my files and it built successfully.
Related
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.
This question already has answers here:
Linker error LNK2019 from 3rd party library
(3 answers)
Closed 10 years ago.
I tried to see what is the problem(s) related to those error messages. I tried to check everything but still, I'm not finding the source of the error.
According to you, the obj error followed by error LNK2019: unresolved external symbol imp__is_CaptureVideo referenced in function, what is its provenance?
I'm using Visual Express C++ 2010.
Thank you.
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_CaptureVideo referenced in function "private: void __thiscall CIdsSimpleLiveDlg::OnButtonStart(void)" (?OnButtonStart#CIdsSimpleLiveDlg##AAEXXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_StopLiveVideo referenced in function "private: void __thiscall CIdsSimpleLiveDlg::OnButtonStop(void)" (?OnButtonStop#CIdsSimpleLiveDlg##AAEXXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_SetImageMem referenced in function "private: void __thiscall CIdsSimpleLiveDlg::OnBnClickedButtonLoadParameter(void)" (?OnBnClickedButtonLoadParameter#CIdsSimpleLiveDlg##AAEXXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_AllocImageMem referenced in function "private: void __thiscall CIdsSimpleLiveDlg::OnBnClickedButtonLoadParameter(void)" (?OnBnClickedButtonLoadParameter#CIdsSimpleLiveDlg##AAEXXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_SetColorMode referenced in function "private: void __thiscall CIdsSimpleLiveDlg::OnBnClickedButtonLoadParameter(void)" (?OnBnClickedButtonLoadParameter#CIdsSimpleLiveDlg##AAEXXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_AOI referenced in function "private: void __thiscall CIdsSimpleLiveDlg::OnBnClickedButtonLoadParameter(void)" (?OnBnClickedButtonLoadParameter#CIdsSimpleLiveDlg##AAEXXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_FreeImageMem referenced in function "private: void __thiscall CIdsSimpleLiveDlg::OnBnClickedButtonLoadParameter(void)" (?OnBnClickedButtonLoadParameter#CIdsSimpleLiveDlg##AAEXXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_ParameterSet referenced in function "private: void __thiscall CIdsSimpleLiveDlg::OnBnClickedButtonLoadParameter(void)" (?OnBnClickedButtonLoadParameter#CIdsSimpleLiveDlg##AAEXXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_EnableMessage referenced in function "private: bool __thiscall CIdsSimpleLiveDlg::OpenCamera(void)" (?OpenCamera#CIdsSimpleLiveDlg##AAE_NXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_GetSensorInfo referenced in function "private: bool __thiscall CIdsSimpleLiveDlg::OpenCamera(void)" (?OpenCamera#CIdsSimpleLiveDlg##AAE_NXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_RenderBitmap referenced in function "private: long __thiscall CIdsSimpleLiveDlg::OnUEyeMessage(unsigned int,long)" (?OnUEyeMessage#CIdsSimpleLiveDlg##AAEJIJ#Z)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_ExitCamera referenced in function "private: void __thiscall CIdsSimpleLiveDlg::ExitCamera(void)" (?ExitCamera#CIdsSimpleLiveDlg##AAEXXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_GetColorDepth referenced in function "private: int __thiscall CIdsSimpleLiveDlg::InitDisplayMode(void)" (?InitDisplayMode#CIdsSimpleLiveDlg##AAEHXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_SetDisplayMode referenced in function "private: int __thiscall CIdsSimpleLiveDlg::InitDisplayMode(void)" (?InitDisplayMode#CIdsSimpleLiveDlg##AAEHXZ)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_GetDuration referenced in function "private: int __thiscall CIdsSimpleLiveDlg::InitCamera(unsigned long *,struct HWND__ *)" (?InitCamera#CIdsSimpleLiveDlg##AAEHPAKPAUHWND__###Z)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_InitCamera referenced in function "private: int __thiscall CIdsSimpleLiveDlg::InitCamera(unsigned long *,struct HWND__ *)" (?InitCamera#CIdsSimpleLiveDlg##AAEHPAKPAUHWND__###Z)
1>IdsSimpleLiveDlg.obj : error LNK2019: unresolved external symbol __imp__is_ImageFormat referenced in function "private: void __thiscall CIdsSimpleLiveDlg::GetMaxImageSize(int *,int *)" (?GetMaxImageSize#CIdsSimpleLiveDlg##AAEXPAH0#Z)
1>nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
1>nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
1>C:\Program Files\IDS\uEye\Develop\Source\SimpleLive\Debug\po.exe : fatal error LNK1120: 19 unresolved externals
I have added the correspondent library by clicking on the properties
of my project and then, adding the directory to the Library Directories
It seems like you've added the 'Additional Library Directory' to your VS Project - but didn't link the actual library file (windows extension: .lib). I think what you did is
Project Properties -> Configuration Properties-> Linker -> General -> Additional Library Directories
and added the directoy where your 3rd party '.lib' is inside. But in fact this doesn't link against that '.lib' file by itself (it just added the directory where VS is searching for the linked .lib files).
Try the following:
Right click on your project -> Project Properties -> Configuration Properties-> Linker -> Input -> Additional Dependencies
There is a list like:
'kernel32.lib;user32.lib;...;%(AdditionalDependencies)'
And somewehere inside there should the name of your '.lib file' appear. If it doesn't, you've to add it there. I.e. if the lib of your 3rd party library is named 'myLib.lib' you would insert there instead
'kernel32.lib;user32.lib;...;myLib.lib;%(AdditionalDependencies)'
I get these errors when i try to put together a GLSL example program from a website, just so i can get a feel for shaders. I also get these exact same errors when i try to implement this shader in my own program.
http://www.swiftless.com/tutorials/glsl/1_setup.html#DL
>------ Build started: Project: TheLightingExperiment2, Configuration: Debug Win32 ------
1> main.cpp
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall Shader::init(char const *,char const *)" (?init#Shader##QAEXPBD0#Z) referenced in function "void __cdecl init(void)" (?init##YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall Shader::unbind(void)" (?unbind#Shader##QAEXXZ) referenced in function "void __cdecl display(void)" (?display##YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall Shader::bind(void)" (?bind#Shader##QAEXXZ) referenced in function "void __cdecl display(void)" (?display##YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall Shader::Shader(void)" (??0Shader##QAE#XZ) referenced in function "void __cdecl `dynamic initializer for 'shader''(void)" (??__Eshader##YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall Shader::~Shader(void)" (??1Shader##QAE#XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'shader''(void)" (??__Fshader##YAXXZ)
1>C:\Users\Shawn\Desktop\TheLightingExperiment2\Debug\TheLightingExperiment2.exe : fatal error LNK1120: 5 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
These are undefined reference errors. from the Linker.You didn't attach the libraries. as you are in Visual Studio you can do this by right clicking on your Solution and thenby going to Properties.
It looks like you are missing libraries. Look into GLEW the GL Extension Wrangler and link that into your project. It is especially helpful with making shader extensions work.
GLEW Page
I am working on a DirectX 11 project for school and I followed the book thoroughly when doing this. I keep thinking that maybe something is labeled wrong but I double checked all my files, all my class names are fine (I believe they are fine) and double checked how all my header files are setup and everything should be okay and I still get this error output:
1>BlankDemo.obj : error LNK2019: unresolved external symbol "public: __thiscall DemoBase::DemoBase(void)" (??0DemoBase##QAE#XZ) referenced in function "public: __thiscall BlankDemo::BlankDemo(void)" (??0BlankDemo##QAE#XZ)
1>BlankDemo.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall DemoBase::~DemoBase(void)" (??1DemoBase##UAE#XZ) referenced in function "public: virtual __thiscall BlankDemo::~BlankDemo(void)" (??1BlankDemo##UAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall DemoBase::Shutdown(void)" (?Shutdown#DemoBase##QAEXXZ) referenced in function _wWinMain#16
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall DemoBase::Initialize(struct HINSTANCE__ *,struct HWND__ *)" (?Initialize#DemoBase##QAE_NPAUHINSTANCE__##PAUHWND__###Z) referenced in function _wWinMain#16
1>C:\Users\vaughn\documents\visual studio 2010\Projects\BlankWindow\Debug\BlankWindow.exe : fatal error LNK1120: 4 unresolved externals
How do I solve this?
Evidently, you either haven't implemented a handful of methods from the DemoBase class (including its constructor and destructor), or you haven't included the implementation file in the list of files to compile or link with your program. Implement them, and then make sure you've included the source file in your project.
I am coming from Xcode, trying to compile a project in Visual Studio 2010, and I get the following errors:
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "struct _GUID __cdecl CLEyeGetCameraUUID(int)" (?CLEyeGetCameraUUID##YA?AU_GUID##H#Z) referenced in function "public: static int __cdecl ofxCLeye::listDevices(void)" (?listDevices#ofxCLeye##SAHXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "int __cdecl CLEyeGetCameraCount(void)" (?CLEyeGetCameraCount##YAHXZ) referenced in function "public: static int __cdecl ofxCLeye::listDevices(void)" (?listDevices#ofxCLeye##SAHXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraGetFrameDimensions(void *,int &,int &)" (?CLEyeCameraGetFrameDimensions##YA_NPAXAAH1#Z) referenced in function "public: void __thiscall ofxCLeye::grabFrame(void)" (?grabFrame#ofxCLeye##QAEXXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraGetFrame(void *,unsigned char *,int)" (?CLEyeCameraGetFrame##YA_NPAXPAEH#Z) referenced in function "public: void __thiscall ofxCLeye::grabFrame(void)" (?grabFrame#ofxCLeye##QAEXXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeDestroyCamera(void *)" (?CLEyeDestroyCamera##YA_NPAX#Z) referenced in function "public: virtual void __thiscall ofxCLeye::close(void)" (?close#ofxCLeye##UAEXXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraStop(void *)" (?CLEyeCameraStop##YA_NPAX#Z) referenced in function "public: virtual void __thiscall ofxCLeye::close(void)" (?close#ofxCLeye##UAEXXZ)
... etc etc...
2>bin\clEye_debug.exe : fatal error LNK1120: 10 unresolved externals
I imagine that the compiler is trying to link CLEyeMulticam.lib but not finding it. I think that I have configured it properly.
Could you point me with the needed steps to include a library in VS2010 ?
Thank you,
marc
Apologies if this is overly pedantic. If this is a pre-built library (not built as part of the project/solution) then make sure you
a) #include the correct header
b) #define any requisite macros
c) speciy additional .lib dependencies as shown below.
You will need to specify a fully qualifed path (d:\src\project\libs\camera.lib) unless the libary file is in the LIB environment variable.
In the Property Pages for your project, navigate to Configuration > Linker > Input and add the lib file to the Additional Dependencies setting. This applies to VC++ 2008, probably likewise to 2010.