error LNK2019: unresolved external symbol SHInitExtraControls referenced? - c++

How can i resolve this error:
Error 1 error LNK2019: unresolved external symbol SHInitExtraControls referenced in function "public: virtual int __cdecl CTestApp::InitInstance(void)" (?InitInstance#CTestApp##UAAHXZ) Test.obj
thanks

You need to link against aygshell.lib. Note that the MSDN page for SHInitExtraControls() says that aygshell.lib is the required library to use it.
A LNK2019 usually means that you forgot to provide a definition of something. In this case, the definition of SHInitExtraControls() is located in aygshell.lib. Without it, the linker will complain when you attempt to use SHInitExtraControls().
To link against aygshell.lib in Visual Studio, go to Project --> Properties --> Linker --> Input --> Additional Dependencies then type aygshell.lib in the box.

Related

Unresolved external symbols linking to glew32s.lib

So this isn't the first time I have run into this problem, but the solutions that worked in the past don't seem to be working. I am currently receiving the following errors:
Error LNK1120 6 unresolved externals
Error LNK2019 unresolved external symbol __imp__glGetString#4 referenced in function _glewContextInit#0
Error LNK2019 unresolved external symbol __imp__wglGetCurrentDC#0 referenced in function _wglewGetExtension#4
Error LNK2019 unresolved external symbol __imp__wglGetProcAddress#4 referenced in function __glewInit_GL_3DFX_tbuffer
Error LNK2019 unresolved external symbol __imp__glClear#4 referenced in function "public: void __thiscall vortex::graphics::Window::clear(void)const " (?clear#Window#graphics#vortex##QBEXXZ)
Error LNK2019 unresolved external symbol __imp__glEnable#4 referenced in function "private: bool __thiscall vortex::graphics::Window::init(void)" (?init#Window#graphics#vortex##AAE_NXZ)
Error LNK2019 unresolved external symbol __imp__glViewport#16 referenced in function "void __cdecl vortex::graphics::windowResize(struct GLFWwindow *,int,int)" (?windowResize#graphics#vortex##YAXPAUGLFWwindow##HH#Z)
to give you a rundown of what I have tried, I have checked and rechecked the linking paths to the libraries, I have put the GLEW_STATIC preprocessor definition in the necessary section, I have redownloaded the libraries multiple times to make sure I was linking a Win32 library to the Win32 application, and I have no idea what to do now. It was working fine for awhile, and the above solutions would always fix this sort of error, but not this time. The sooner I can get a response the better, as this is a project that I wanna get more work done on soon. Thank you for any help you can give me.
Add OpenGL32.lib and glu32.lib to your linker inputs.
Add opengl32.lib to your linker inputs, and
add GLEW_STATIC to your Properties->C/C++->Preprocessor->Preprocessor Definitions
I had a very similar problem myself, and the solution for me was adding the glew32.dll to the folder, as well as adding #pragma comment(lib, "glew32.lib") and linking to it. The glew32.dll will refer to glew32.lib, so if you dont have it, it will give off similar linking errors.

Unresolved external symbols in C++ project

This is my situation (I am very new to C++ MFC coding and I am trying to debug an existing application project)
I use this line in my code (in a visual studio 2012 MFC project)
CoCreateInstance(CLSID_PortableDeviceValues, NULL,
CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&x));
While I run the project, i get a linker error like this
error LNK2001: unresolved external symbol _CLSID_PortableDeviceValues
This happens for all the CLSID values that I am referring to in the code. Like this
error LNK2001: unresolved external symbol
_CLSID_PortableDeviceKeyCollection
error LNK2001: unresolved external symbol _IID_IPortableDeviceEventCallback
error LNK2001: unresolved external symbol _CLSID_PortableDeviceManager
error LNK2001: unresolved external symbol _CLSID_PortableDeviceServiceFTM
I checked for the declaration of "CLSID_PortableDeviceValues" and it was found in "PortableDeviceTypes.h" and I have imported that library as well.
I do not get any compiler error, but run into the linker errors mentioned above..
Can someone please help me out here. I could not resolve this ..
You will need to add PortableDeviceGUIDs.lib to your project.
(Look up the section "Requirements" in the MSDN documentation for IPortableDeviceValues)
When the linker builds your project, it is looking for the implementation data that is behind the identifier CLSID_PortableDeviceValues. This data is in the library PortableDeviceGUIDs.lib, and the linker has to be told to use this library.
The header file you included in your source code only declares the symbol "CLSID_PortableDeviceValues", without importing its implementation.

error LNK2019: unresolved external symbol _Direct3DCreate9Ex#8 referenced in function "protected: XYX()"

I am getting the following LINK error while compiling my C++ solution:
error LNK2019: unresolved external symbol _Direct3DCreate9Ex#8
referenced in function "protected: XYX()
The symbol "Direct3DCreate9Ex' is defined in "ddraw.h" header file found in "C:\Program Files\Microsoft SDKs\Windows\v7.0\Include". And verified that the header file "ddraw.h" is present in this location. Also I have included this path in VS settings "Tools-->Options-->VC++ Directories -> Includes".
But still I am getting the link error as "error LNK2019: unresolved external symbol _Direct3DCreate9Ex#8 referenced in function "protected: XYX()" ".
Can anyone kindly help me in getting rid of this link error while compiling my C++ solution.
I am using VS 2008 on 64 bit Win7.
Thanks in advance.
Based on reference page for Direct3DCreate9Ex you need to link with D3D9.lib.

unresolved external symbol __imp__Inf and __imp__Nan

I just tried to build Qt for WinCE7.0 using VS2008 after lots of code modification I successfully compiled main libraries.
While Compiling the QtScript library I received the following linker errors:
1>Linking...
1> Creating library ..\..\lib\QtScript4.lib and object ..\..\lib\QtScript4.exp
1>BytecodeGenerator.obj : error LNK2019: unresolved external symbol __imp__Inf referenced in function "public: static double __cdecl QTWTF::FloatHashTraits<double>::emptyValue(void)" (?emptyValue#?$FloatHashTraits#N#QTWTF##SANXZ)
1>Executable.obj : error LNK2001: unresolved external symbol __imp__Inf
1>MathObject.obj : error LNK2001: unresolved external symbol __imp__Inf
1>DateMath.obj : error LNK2019: unresolved external symbol __imp__Nan referenced in function "double __cdecl QTWTF::parseDateFromNullTerminatedCharacters(char const *,bool &,int &)" (?parseDateFromNullTerminatedCharacters#QTWTF##YANPBDAA_NAAH#Z)
1>JSValue.obj : error LNK2001: unresolved external symbol __imp__Nan
1>..\..\lib\QtScript4.dll : fatal error LNK1120: 2 unresolved externals
I have absolutely no idea which libraries I missed to link with!
Thanks
If you're using Windows, I'll assume you're building in MSVS. I often start projects WITHOUT default libs and if I happen to touch "out of reach" terriotry from another lib, I add what I need as I go along.
Fortunately, MSVS is great at helping me with this. Just turn VERBOSE compiling status and see what libs it's trying to access, then just add them:
right click the project, linker, show progress -> select VERBOSE
Another method is when I check MSDN for Microsoft functions and see the lib they are declared in and add it (since VERBOSE can be overkill on my poor output window). I don't know if Qt has a detailed reference documentation (also stating the libs) but it's worth a shot.
When all else fails, just add all libs Qt could possibly want (make sure IGNORE STANDARD LIBS is disabled) then check VERBOSE and only keep those in the list.
Assuming you have all the libraries in the project, another problem is mismatched dependencies (right click the solution, startup project -> select the one you need, [project dependencies -> map each dependency for the specified libs).
Also make sure when you import an extern the lib is defined in Linker->Input.
However, if you modified the source (either adding new functions/global or static vars or you modified function signatures), the unresolved external reference means a function/var definition has no associated body. Either implement one or add { } in the definition; so if that's the case, check the functions/vars from the error message.

Trying to compile program that uses zlib. Link unresolved error

While trying to compile program, that uses zlib, i got following errors:
Error 1 error LNK2019: unresolved
external symbol _compress referenced
in function "void __cdecl
save_image_in_pakfile(class
std::basic_ofstream > &,struct
_IplImage *)" (?save_image_in_pakfile##YAXAAV?$basic_ofstream#DU?$char_traits#D#std###std##PAU_IplImage###Z) buffer_management.obj
Error 2 error LNK2001: unresolved
external symbol
_compress fern_based_point_classifier.obj
And two more same errors but related to uncompress function.
I use the vs2008 C++, and at the project properties I added in
C/C++ : Additional include directories the path to header files of zlib.
And at linker properties I added at additional dependencies:
zlibwapi.lib and zlibstat.lib files.
How to resolv the problem?
If I made some mistakes please show me them..