Troubles liking libraries on a Win32 dll for VS2013 - c++

I am having problems to link my libraries in order to make a dll on VS2013. I have to say that I needed a Desktop dll because of some troubles with the winapifamily so this is a Win32 project and I guess that migh also be an issue but I have not better solution so far. Some of the errors I get:
error LNK2001: unresolved external symbol __imp_NuiCreateSensorByIndex
error LNK2001: unresolved external symbol __imp_NuiSetDeviceStatusCallback
error LNK2001: unresolved external symbol __imp_NuiGetSensorCount
error LNK2001: unresolved external symbol "void __cdecl pcl::console::print(enum pcl::console::VERBOSITY_LEVEL,char const *,...)" (?print#console#pcl##YAXW4VERBOSITY_LEVEL#12#PEBDZZ)
error LNK2001: unresolved external symbol "protected: bool __cdecl pcl::PCLBase<struct pcl::PointXYZ>::deinitCompute(void)" (?deinitCompute#?$PCLBase#UPointXYZ#pcl###pcl##IEAA_NXZ)
error LNK2001: unresolved external symbol "protected: bool __cdecl pcl::PCLBase<struct pcl::PointXYZ>::initCompute(void)" (?initCompute#?$PCLBase#UPointXYZ#pcl###pcl##IEAA_NXZ)
Thank you.

If you want to include external resources you need to explicitly feed them into the Linker or reference them as dynamic lib (explicitly or implicit)
This answer shows a few good steps : https://stackoverflow.com/a/20410798/351861

Related

How to solve link errors while MediaFoundation using?

I have a solution that is works, then I was needed to add a project that has implementation of MediaFoundation. So, in order to include it I added this project as existing one then in configuration in General section I provided path to .h files and then in Liker input added .lib
After this I tried to use it and write include in one of my files and then invoked a few methods from this project that was added.
When I tried to compile my project I got an errors :
9>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFStartup referenced in function "private: bool __cdecl co_AudioDecoderMF::InitAndStartCOMLib(void)" (?InitAndStartCOMLib#co_AudioDecoderMF##AEAA_NXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFShutdown referenced in function "public: virtual void __cdecl co_AudioDecoderMF::Cleanup(void)" (?Cleanup#co_AudioDecoderMF##UEAAXXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateAttributes referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateSourceReader(void)" (?CreateSourceReader#co_AudioDecoderMF##AEAA_NXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateMediaType referenced in function "private: bool __cdecl co_AudioDecoderMF::ConfigureAudioStream(enum co_AudioDecoder::SoundDataType,struct IMFSourceReader *,struct IMFMediaType * *)" (?ConfigureAudioStream#co_AudioDecoderMF##AEAA_NW4SoundDataType#co_AudioDecoder##PEAUIMFSourceReader##PEAPEAUIMFMediaType###Z)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateMFByteStreamOnStream referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateByteStream(unsigned char const *,__int64)" (?CreateByteStream#co_AudioDecoderMF##AEAA_NPEBE_J#Z)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateSourceReaderFromByteStream referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateSourceReader(void)" (?CreateSourceReader#co_AudioDecoderMF##AEAA_NXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MFAudioFormat_PCM
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_MAJOR_TYPE
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_SUBTYPE
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUDIO_NUM_CHANNELS
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUDIO_SAMPLES_PER_SECOND
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUDIO_BLOCK_ALIGNMENT
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUDIO_BITS_PER_SAMPLE
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MFMediaType_Audio
First of all it is strange because I have already use this project in other solution and there weren't problems, but ok after a research I have found out that I need to add in configuration Linker -> input a few more .libs
Mf.lib
Mfplat.lib
mfuuid.lib
(inspire of I don't have these lines in my other solution where does it works) and after I added these lines a lot of error gone, but one left
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateSourceReaderFromByteStream referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateSourceReader(void)" (?CreateSourceReader#co_AudioDecoderMF##AEAA_NXZ)
And I have not found nothing about how to solve it. I am a relatively new in c++ and it looks weird that in order to make MediaFoundation(big lib) work I need to spend a few hours in order to find out what to add in additional in order to make it works.
So, question is - what am I missing here?
You need to include this :
#pragma comment(lib, "mfreadwrite")
Documentation usually helps :
MFCreateSourceReaderFromByteStream function

LIBCURL error in VS2017 C++ :: error LNK2019: unresolved external symbol _curl_easy_init

I compiled CURL for windows to use in VS2017 as
shown in this video
Also i have defined CURL_STATICLIB in preprocessor in C/C++ configuration properties.
Actual project properties is as
But it get below unresolved symbol errors for LIBCURL only
1>mainfile.obj : error LNK2001: unresolved external symbol _curl_easy_init
1>mainfile.obj : error LNK2001: unresolved external symbol _curl_easy_setopt
1>mainfile.obj : error LNK2001: unresolved external symbol _curl_easy_perform
1>mainfile.obj : error LNK2001: unresolved external symbol _curl_easy_cleanup
Please help in resolving , it 5 hrs i have been trying to remove this :(

Porting Qt4 to Qt5, getting unresolved external symbols for OpenGL calls

This is in Visual Studio 2010. I can't find any documentation anywhere that says which library contains these functions. I'm already listing these libraries as dependencies:
Qt5OpenGL.lib;Qt5Gui.lib;Qt5Widgets.lib;qtmaind.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5OpenGLd.lib;Qt5Sqld.lib;Qt5Networkd.lib;opengl32.lib;glu32.lib
I appreciate any help here, as I'm stuck.
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glDeleteProgramsARB#8
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glDeleteShader#4
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glDeleteProgram#4
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glDetachShader#8
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glDeleteBuffersARB#8
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glUnmapBufferARB#4
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glBindBufferARB#8
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glMapBufferARB#8
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glActiveTexture#4
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glUseProgram#4
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glProgramLocalParameter4fARB#24
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glUniform4f#20
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glGetUniformLocation#8
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glUniform1i#8
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glLinkProgram#4
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glAttachShader#8
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glCreateProgram#0
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glCompileShader#4
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glShaderSource#16
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glCreateShader#4
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glGetShaderInfoLog#16
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glGetShaderiv#12
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glGetProgramInfoLog#16
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glGetProgramiv#12
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glProgramStringARB#16
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glBindProgramARB#8
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glGenProgramsARB#8
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glBufferDataARB#16
1>videograph_opengld.lib(videorenderer.obj) : error LNK2001: unresolved external symbol _glGenBuffersARB#8
The symbols your linker reports missing are actually not contained in any library you could link to in Windows. They're modern OpenGL profile and extension functions which need to be loaded at runtime after a OpenGL context has been created.
That you get reported those symbols missing indicates, that something has been messed up very seriously when building the videograph library you're using; or the author of that library didn't care much for seamless integration into other projects.
Note that using an extension loader-wrapper library like GLEW may not help you there, because those must be initialized, e.g. by calling glewInit, but libraries are kind of black boxes, so you don't know when to call it. You can try linking with GLEW and call glewInit() at a point where you have an OpenGL context, but YMMV.
There was an #ifdef Q_WS_WIN wrapper to name the functions for the DLL, and it was not defined. Qt changed to Q_OS_WIN in Qt5, so making that substitution fixed the problem.
You might be missing some other key dependencies, open up Properties -> Linker -> Input and set Additional Dependencies to
opengl32.lib
glu32.lib
delayimp.lib
imm32.lib
winmm.lib
plus whatever you currently have, the reference im using might be dated though, you can find it here

I am trying to use a 2005 era library with MSVC 2013 but I am getting unresolved externals errors in Release Mode

The setup:
I have successfully compiled DarkGDK, a library designed for use with DirectX SDK 2007 and VS 2008, in VS 2013 with DirectX SDK 2010. I replaced one of the component libraries with a custom dummy library to resolve DirectX conflicts. I was able to successfully compile all of these component libraries.
The Problem:
When I compile my project that makes use of the DarkGDK libraries in Release mode, everything works as expected. I do get an message box complaining that the binary was built without debug information, but my program runs. However, in Debug mode, I get a number of errors. Below find a sample that I believe represents the lot well:
1>convmdl.lib(ConvMDL.obj) : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "void __cdecl QuaternionSlerp(float const * const,float * const,float,float * const)" (?QuaternionSlerp##YAXQBMQAMM1#Z)
1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>system.lib(CSystemC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>system.lib(dxdiaginfo.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>convx.lib(ConvX.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>convmd3.lib(ConvMD3.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(CBSPTree.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(CCompiler.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(ProcessHSR.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>world.lib(Patch.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(Universe.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(cLightMaps.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(CSG.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(NVMeshMenderD3DX.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>image.lib(CImageC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>animation.lib(CAnimation.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(DBOFormat.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(CObjectManagerC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>core.lib(RenderList.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>display.lib(CGfxC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>file.lib(CFileC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>sprites.lib(CSpriteManagerC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>Debug\Weapon Creator 2 - Project Golden Girl.exe : fatal error LNK1120: 1 unresolved externals
I have been searching about this issue for a few days now. I have have checked all the projects' settings that belong to the DarkGDK library and my own project's settings. In Debug configuration they are all using "Multi-threaded Debug (/MTd)".
TL;DR
I am getting the above errors when attempting to compile a project in Debug configuration that uses the DarkGDK Library. All projects have the same Windows Library and C run time settings.
Thank you!
Edit: Errors changed to reflect Dauphic's contribution.
You're mixing debug and release runtimes.
__CrtDbgReportW only exists in the debug runtime. If it's unresolved, it means you're probably compiling using the release runtime, but one of your libraries is using the debug runtime. You have to recompile one or the other, so they both use the same version.
You can find the runtime property at Project Properties -> C/C++ -> Code Generation -> Runtime Library
For the unresolved ATL symbol, I believe you need to link atls.lib.

Calling a c++ .exe from Matlab - Program Stopped Working?

I wrote a code in C++ called FaceTracker.cpp and other code in Matlab that do some analyzes and statics.
What I need to do is adding a button in matlab that calls the FaceTracker when being pressed. I tried to use the following command:
system (['FaceTracker.exe <' nameOfVideo]);
but it doesn't work. It opens the FaceTracker.exe GUI, then it stops ! (Like when internet explorer or any other program does sometimes\hang) with the msg "FaceTracker.exe stoped working.
When I tried to run the .exe from command prompt it showed me the following error:
Assertion Faile: Type == IO::TRACKER ... Debug error! R6010 - abort() has been called.
From what i understd from the answers\ other sites is that I need to statically link libraries.
I read in one site that I need to make the following changes:
The CRT:
• Configuration Properties -> C/C++ -> Code Generation: Where it reads Runtime Library, change to Multi-Threaded (/MT).
The manifest must go:
• Configuration Properties -> Manifest Tool -> Input and Output: Where it reads Embed Manifest, change to No.
But when I do it (Change to /MT) I start getting the following errors:
1> Generating Code... 1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>Tracker.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: void
__thiscall FACETRACKER::Tracker::Load(char const *)" (?Load#Tracker#FACETRACKER##QAEXPBD#Z) 1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol
__CrtDbgReportW 1>libcpmtd.lib(cin.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>IO.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>Patch.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>PAW.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>PDM.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>CLM.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>FaceTracker.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>FCheck.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>FDet.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>libcpmtd.lib(cin.obj) : error LNK2001: unresolved external symbol
__free_dbg 1>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __free_dbg 1>Tracker.obj : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(xdebug.obj) : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol
__free_dbg 1>IO.obj : error LNK2001: unresolved external symbol __free_dbg 1>Patch.obj : error LNK2001: unresolved external symbol __free_dbg 1>PAW.obj : error LNK2001: unresolved external symbol __free_dbg 1>PDM.obj : error LNK2001: unresolved external symbol __free_dbg 1>CLM.obj : error LNK2019: unresolved external symbol __free_dbg referenced in function "private: void __thiscall std::_Yarn<char>::_Tidy(void)" (?_Tidy#?$_Yarn#D#std##AAEXXZ) 1>FaceTracker.obj : error LNK2001: unresolved external symbol
__free_dbg 1>FCheck.obj : error LNK2001: unresolved external symbol __free_dbg 1>FDet.obj : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char
*,int)" (??2#YAPAXIABU_DebugHeapTag_t#std##PADH#Z) 1>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol __malloc_dbg 1>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __malloc_dbg 1>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_dbg referenced in function __Getctype 1>C:\Users\wew\Documents\Jam3a\PROJECT-2012!!\FindSymetryInFaces\FaceTracker\Debug\FaceTracker.exe : fatal error LNK1120: 4 unresolved externals
Any Suggestions?
What do I Have to do in order to be able to use the FaceTracker.exe in every computer, also the ones that doesn't have c++\vs compiler?
besides, why does my program OPENS when I call it from matlab but then Hangs\stops working?
Thank in advance.
This almost certainly has nothing to do with debug versus release or whether mt is enabled. You are not making a matlab extension, just using a binary from the command line. If the program works when you type things in from the command line, it should work when called from Matlab unless you are running low on memory (highly unlikely also).
I would examine the contents of . .
['FaceTracker.exe < ' InputVid]
...and copy and paste the string directly into the command line (system, not Matlab) to see if you can replicate the error. The error is most likely occurring because your exe is not handling the file string well.
Try putting the inputvid, calling m file, and FaceTracker.exe in the working directory to make the most simple scenario. If that works, make things more complex by placing input vid into another directory and bug hunt from there.
Best of luck!
I think this exe file depends on some other libraries. You should copy them into one of the directories in your system parameter PATH. Or you can use the static link option when build your project.
Your applications don't require the entire Visual C++ compiler to be installed, just the runtime library. Microsoft has a free redistributable which can add this runtime library to any computer. You can find vcredist_x86.exe in your Visual C++ install path, or download it from http://www.microsoft.com/en-us/download/details.aspx?id=8328