First time I actually started writing a project in C++, for purposes. I'd like to include the TNL library.
The header files are already defined correctly and can use them. For the linker, when i try to use a function that's in the lib file it still gives me a LNK2019 error. The lib is added to the linker.
Error message example:
Here are some screenshots with the paths. I 'think' that i've put them correctly but could definitely looked over something.
Additional Dependencies:
Additional Library Directories
Actual Library Lib's are located at:
I'm probably tunnel-visioning on something. But I'm stuck right now and I'm clueless.
The unresolved symbol is _closesocket#4, which should probably resolve to closesocket() from the Windows sockets library. Try adding "Ws2_32.lib" to the Additional Dependencies line.
Related
I am having an odd issue and think there is a simple answer to that but I guess I just can't see the forest because of all the trees.
I am trying to compile a program using Intel IPP (Visual Studio 2015) and get the following error message:
unresolved external symbol _ippiResizeGetSize_8u#32
I added the appropriate folders to the project properties, which did not work. So just to be on the safe side I just copied all static libs and the corresponding header files into the folder where to code of the program lies. It does find the header files but I am also getting the above error. The libs are added as dependencies. I have set IPP so that it uses single-threaded static libraries.
What am I doing wrong here? It seems to be straightforward.
Thank you
Pat
All unresolved symbol error come from VS linker. Basically, it means that you haven't added to linker "input" property the static library, which resolves the required external name.
In your case it is IPP image processing library, i.e. "ippimt.lib" (of the latest IPP versions), or "ippi_l.lib" of IPP v.7.x.
You can add the full name of ippi* library to "input" property, or add IPP library directory to the "general/additional directory" property of VS linker and name of the library file to "input" property. You don't need to copy static libraries to working directory, it doesn't work.
Regards, Sergey
I have an object file library that exists as a standalone VC++ project. I have a number of other completely separate VC++ solutions, and I would like some of them to utilise the classes included in this library.
I have added the project to a solution as detailed here: (See docs). I have followed all of the instructions but am still getting "unresolved external symbol" errors when trying to use the class.
Can anyone help?
Specifics:
The class library in question is an SQL access library. Inside there are two files, sql.h and sql.cpp. Pretty simple. That project compiles itself absolutely fine, so I know there is nothing wrong with that project. I was under the impression that to get the project included in an existing solution I had to:
Add the project to add the project to the solution
Add a reference to the project
Add the include directory
Add #include "sql.h" to the project
That is what I have done, to no success.
Please make sure the external library is linked into your project. It usually comes in a form of a .lib file (for example, sql.lib)
Go to Configuration Properties ->Linker and add your library to the "Additional Dependencies" list.
I know this is a common problem and I can see quite a few questions about LNK2019 but I can't for the life of me find what I'm missing.
I am working on a C++ DirectX project and I want to use the DirectXTK library (Direct X Tool Kit). I have included the project in my solution and it builds fine.
I've also included the ScreenGrab.h header I want to use in my own project. Intellisense picks up the function definitions from ScreenGrab.h fine and so I have called SaveDDSTextureToFile().
But when I go to build the project I get the LNK2019 error on SaveDDSTextureToFile(). I'm assuming this means it knows where the definition is (in the header) but can't find the implementation of the function in the .obj or .lib, is this correct?
I assume I need to tell the linker where these files are? I tried doing that in Properties->Configuration Settings->Linker->General->Additional Library Directories but I still get the LNK2019 error.
Does anyone know what I'm still missing?
Thanks for your time.
Stupidly, I didn't add the lib to the Linker oops.
Basically for anyone else that forgets this step - after you've added the directory to Linker->General, go over to Linker->Input and add the name of the .lib to "Additional Dependencies" - so for me I typed "DirectXTK.lib" here (without the quotes).
If I hadn't added the directory to Linker->General I also could have typed "../folder1/folder2/folder-etc/DirectXTK.lib" here depending on the relative path from where my project is.
Sorry for wasting people's time and I hope this helps others.
Make sure your linker->general->additional library directories configuration is for all configurations, and not just "release" or "debug". Try adding the static library file (depending on the Direct3D version you're using) to your project from the SDK directories - if it compiles then you've definitely done something wrong with the linker configurations.
I have a project that includes files from a different project. I am getting linking errors...
"unresolved external symbol "public: _cdecl classA::classA(void"
(??()classA ##QEAA#XZ) referenced in function "class classA *_cdecl
functionB(char const*)" (?functionB##YAPEAVClassA##PEBD#Z)...
and other 125 errors of the same type (after the constructor, which is the error I just listed, every function from the class I use is mentioned in one of the link errors).
The path for including the files of the second project is included in my property sheet. That project, on its own, builds fine.
I have tried to add that project to my solution, and add it as a dependency. No help. I have tried to add the dll that it creates in the project - linker - input. No help.
In Configuration properties, the Runtime Library is set to /MTd.
I have even tried to add extern "C" in front of my include. No help.
I have tried to build them with Debug or Release, x64 or Win32. I prefer Release x64 but I'll take anything.
Could you please help me - tell me what am I doing wrong, or where to look to fix this problem ? Thank you very much.
When you build the project which yours depends on, it should produce both a lib and a dll. You need to link that lib with your project. See this thread for a screenshot of how to link the lib in your project.
I found out that my dependencies in the Link - Input were being removed by the fact that I didn't explicitly specify that I can have dependencies in the property sheet. After changing the property sheet, I finally was able to create a dll.
after very long long time spent with unresolved externals I found that VS2010 was linking wrong .lib file.
Files were unfortunately named with same name.
Folder with linked(unwanted) lib was set in project properties
Folder with unlinked(wanted) lib was inherited from other property sheet
Desired lib was newer date, undesired was very older.
Linker chose the unwanted one (as above).
What are the rules for linking libs?
Shouldn't linker give at least warning on some ambiguity?
edit:
symbol is defined ONLY in NEW lib. And the NEW lib is being searched only when I delete OLD lib (no linker settings changed)
Think of LIBs to Linker as header to compiler. A LIB only has signature of exported symbols, unless it is static LIB. LIB files do not have any version attached to them.
Two LIB file can have same name, as two header files can have. It's you, the programmer, who has to use correct LIB/header file. If the linker doesn't find all symbols, or if symbols are not correct, it will report error (just like compiler will do for inconsistent symbols in header file).