Libpd configuration in Visual C++ 2010 - c++

I'm trying to import and run the C++ sample project coming with the libpd API CppTest within a Visual C++ 2010 project.
I imported the C++ API files of libpd, i.e. PdBase, PdReceiver, PdMidiReceiver and PdTypes, with corresponding source files in the case of PdBase and PdTypes. I put as additional include directories the include folder of Pure Data
("C:\pd_installation_folder\include") and the libpd_wrapper folder containing the C code of the libpd wrapper.
When i run the solution of the sample project it doesn't work due to an error during the linking phase, "error LNK2019" with a huge list of unresolved externals.
What's the problem here?
Should I have any libpd additional static library (or .dll) provided to the linker configuration properties of the VC++ project?

Related

Including an external library to my own library project c++ visual studio

Currently i have 3 visual studio projects:
ConsoleApplication
Logic
Test
These projects are all in the same solution. In the Logic project i use an external library named curl. My logic project is a static library made with the "new project" wizard in visual studio. This project includes a pch.h file. I added following things to my Logic project properties:
Set C/C++ > General > Additional Include Directories to the folder with the header files of curl
Set Libarian > General > Additional Library Directories to the folder with curl.lib in it.
Set Libarian > General > Additional Dependencies to curl.lib.
Now when i build the Logic project the output is a Logic.lib file. i checked with DUMPBIN /SYMBOLS /EXPORTS Logic.lib if the Curl functions are actually in the lib file, and they are.
To include the Logic project into the Console application i did the same 3 steps and added the Logic.lib to the Console application project. Everything works fine untill the moment i start using classes that use the external curl library. When i use these classes i get a link error: Unresolved external symbol (LNK 2019). I have tried much to fix this, but it seems that i am not capable of solving it. Am i doing something wrong that causes this not to work?
Also i would like to be able to use my logic project the same way as i do in my ConsoleApplication in my test project. For more context why i splitted up those projects can be found in my previous question Use c++ classes from console application class in other project visual studio
So after hours of research i found this post and i think this also applies to my case: Linking static libraries to other static libraries
TL;DR static libraries do not link with other static libraries
So i think the best solution in my case is to convert the static logic library to a dynamic lib (DLL)

C++ detours linking issue

I have problems building my code that is using static lib detours. I am trying to do an old basic CTF. For that I want to get into detours.
Whenever I try to build my .dll file I get an issue
LNK2019 unresolved external symbol _DetourTransactionBegin#0 referenced in function _DllMain#12
Now, I have built the detours library using 3 different version of the visual studio dev console.
I have tried firing 'vcvars32.bat' and then using nmake to build the library which was able to build it, but I get the above error during linking my .dll. I have also tried building it with 'vcvarsamd64_x86.bat' and then using nmake to build it which also was able to build the library, but I still get the same error as above during linking.
I have tried the usual stuff: the include folder for detours.h is added to C++/General/Additional Include Directories.
Under Linker/Additional Library Directories I added them as follows: "C:\temp\det_retry\lib.X64";"C:\temp\det_retry\lib.X86";%(AdditionalLibraryDirectories).
And also under Linker/Input/Additional Dependencies I have the following: detours.lib;%(AdditionalDependencies)
What am I missing here? This is a blocker for me for a couple of days and I am reiterating the same steps trying to figure out what's missing but I cannot see. I'd really appreciate the input.
I am sure I am using the newest version because I have downloaded (cloned) detours from the ms github page.
It appears your "Additional Library Directories" are setup incorrectly or contain invalid entries rather. They look like actual library file entries (i.e. pointing to some specific files) versus being only directories (e.g. "my/lib/path/for/my_project/"). Visual Studio's naming conventions are somewhat cryptic but they should be directory entries only. There should be an entry to whatever directory contains the detours.lib file (e.g. "MyProject/Libs/MSDetour" ... where MSDetour is a folder with the "detours.lib" in it) and then Visual Studio should find the library and link everything correctly.
As a side note, if you are using the Visual Studio developer console for building your project/solution you might want to look into CMake ... it is, in my opinion, significantly easier to work with (less "settings" digging) and maintain in the long-run.

Fatal error “LNK1104: cannot open file 'libCbc.lib'” when I compile a C++ project in Visual Studio 2017?

I've never used VS before.
My friend shared with me his program working and running correctly (she uses VS 2013 and I use 2017 - any compatibility problem?).
I've downloaded it and changed the paths on
Configuration Properties, C and C++, General, Additional Include Directories (picture below)
Configuration Properties, Linker, General, Additional Library Directories
However Im getting one fatal error which does not find this file located in:
Users\Julio\Documents\CPFL\SolverCPP\coin\libdebug
Users\Julio\Documents\CPFL\SolverCPP\coin\lib
How can I solve this path error? Also any tip to share project is welcome,

Visual Studio static library : NuGet package not found when using in another project

I'm building a static library using Visual Studio, which involves installing nupengl and glm. Then I linked it to a test project via this method :
Project Properties -> VC++ Directories -> Additional include library (I entered the directory which contains my header files from the library)
Project Properties -> Linker -> Input (I entered the directory which contains the .lib file for the library)
I added the header files in the library to my test project
But when I run the test program, it produces things like :
GLFW/glfw3 not found
How can I use the installed NuGet package for the library when calling the library from another project ? Any help would be highly appreciated

LNK1104 Cryptopp.lib with CRYPTOPP_DEFAULT_NO_DLL defined in dll project

I'm using Visual Studio 2013, with the 2012 toolset and I'm trying to split an win32 executable project up into an exe that consumes a dll that contains all the program logic. The end goal is to be able to create a seperate project for unit tests that can link against the new dll.
Now the old version of the project compiles absolutely fine and uses cryptlib.lib (thanks SVN!), but once I separated it out in to a dll with the program logic and the same project settings I get the following error when I attempt to build the dll:
Error 546 error LNK1104: cannot open file 'cryptopp.lib'
I have the directory that contains cryptlib.lib in my linker settings and I'm linking against it just as I did in the previous project settings. Based on the documentation it shouldn't be trying to link against cryptopp.lib because CRYPTOPP_DEFAULT_NO_DLL is defined in the preprocessor settings.
I also tried adding the directory that contains cryptopp.lib to the VC++ directory paths and I added cryptopp.lib to my linker settings, and it still gives me the same error. I don't want to use the dll version of cryptopp, but at this point I just need the thing to work.
All the projects are using the 2012 toolsets, and all are being compiled as win32 projects so I'm not sure where to go from here.
Well I figured out what was happening, if not why. For some reason the preprocessor definitions don't seem to be getting applied. If I put CRYPTOPP_DEFAULT_NO_DLL at the top of all the include files it works as expected.