how to build voro++ in visual studio 2017? - c++

I have downloaded the last version on voro++, then I have added voro++ src path to "include directories". However, this error occured:
LNK2019 unresolved external symbol "public: __thiscall voro::voronoicell_base::voronoicell_base(void)" (??0voronoicell_base#voro##QAE#XZ) referenced in function "public: __thiscall voro::voronoicell::voronoicell(void)" (??0voronoicell#voro##QAE#XZ)
How can I solve this problem?

This library is distributes as source code and uses make file based build system. You need to compile it first into static library. Note that it does not support Visual Studio out of box so to build it you'll probably need to set up your own VS project and deal with all the porting issues that may arise.

Related

LNK 2001 and LNK 2019 errors occurring between linked DLLs ONLY when using 64-bit (x64) build platform on Visual Studio C++ MFC Desktop Application

The title basically covers it.
The DLLs seem to be linked fine in the Linker property pages settings, based on that fact that they link without issue when using the 32-bit build platform.
I have looked into the two LNK errors online but haven't found anything that's been able to address the problem specifically.
Has anyone seen this before, or does anyone have thoughts on how to approach this?
Here are a couple of examples of the errors:
Error
LNK2001
unresolved external symbol "public: class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > __cdecl CUserContext::GetUserDisplayName(void)" (?GetUserDisplayName#CUserContext##QEAA?AV?$CStringT#DV?$StrTraitMFC_DLL#DV?$ChTraitsCRT#D#ATL#####ATL##XZ)
ApplicationIMPLDLL
Error
LNK2019
unresolved external symbol "public: int __cdecl CDBManager::IsOpen(void)" (?IsOpen#CDBManager##QEAAHXZ) referenced in function "public: __cdecl CApplicationIMPLManager::CApplicationIMPLManager(class CDBManager *)" (??0CApplicationIMPLManager##QEAA#PEAVCDBManager###Z)
ApplicationIMPLDLL
According to Microsoft Docs, there is one cause of lnk2019 and lnk2001:
You attempt to link 64-bit libraries to 32-bit code, or 32-bit libraries to 64-bit code
Libraries and object files linked to your code must be compiled for
the same architecture as your code. Make sure the libraries your
project references are compiled for the same architecture as your
project. Make sure the /LIBPATH or Additional Library Directories
property points to libraries built for the correct architecture.
based on that fact that they link without issue when using the 32-bit build platform This sentence seems to indicate that your dll is 32-bit. If so, Windows can not load a 32-bit dll into a 64-bit process.
If you have the source code of these dlls, you could compile them into 64-bit.
Of course, there is also a way to load 32-bit dll into 64-bit program. You could refer to this link for more details.

SCIP and Visual Studi: error LNK2019

I want to solve the n-queens problem using SCIP (version 3.2.1) in Visual Studio 2010 (version 10.0.40219.1).
Source files can be found here: http://scip.zib.de/download/files/Queens.tgz
I did not write any code myself, but just included queens.hpp, scip_exceptions.hpp, queens.cpp and queens_main.cpp in my VS project.
In the project properties I did the following:
C/C++ -> General -> Additional Include Directories -> C:\scipoptsuite-3.2.1\scip-3.2.1\src\.
When building, I get errors like:
LNK2019: unresolved external symbol SCIPaddCons referenced in function "public: __thiscall cipexamples::QueensSolver::QueensSolver(unsigned int)"
I understand that I will have to link SCIP libraries to my project? But I do not know which ones and where to find them?
You need to compile the SCIP Optimization Suite first to obtain the libscipopt that you need to link to your project. It will contain everything necessary to work with SCIP.
Alternatively, you may also just use the precompiled dlls from the webpage:
http://scip.zib.de/#download

Visual Studio 15 __imp___iob, __imp___pctype, __imp___mb_cur_max

I am trying to use a library compiled with mingw in visual studio. However, I get the following linker errors:
error LNK2001: unresolved external symbol __imp___iob
error LNK2019: unresolved external symbol __imp___pctype referenced in function
error LNK2019: unresolved external symbol __imp____mb_cur_max referenced in function
error LNK2001: unresolved external symbol _fprintf
I was able to fix the _fprintf error by linking against legacy_stdio_definitions.lib as per this post : unresolved external symbol __imp__fprintf and __imp____iob_func, SDL2.
However, I have no idea how to fix the other three unresolved externals. How can I fix this? The libraries work perfectly under Visual Studio 2013.
Edit:
Okay here is an update. I moved libmsvcrt.a from the mingw lib folder into Visual Studio, and I added that to the linker settings. Now it seems to work correctly.
The libraries were compiled against an old version of the CRT. The unresolved symbols you get are internal symbols of the CRT that are present in the compiled library. You have to recompile the library against the VS2015 CRT (the Universal CRT). But I'm not sure if MinGW supports this.
If you can't do that, you have to continue to use the VS2013 compiler. (You can use the VS2015 IDE, by setting the toolset to vs2013 in the project options. But you'll still be limited to the C++ features the 2013 compiler supports.)
I encountered the same problem (library compiled with static CRT instead of CRT in DLL) and I managed to make it work by changing the two following parameters in Project Properties:
Linker > Input > Ignore specific default libraries: libc.lib
C/C++ > Code Generation > Runtime Library: Multi-threaded Debug (/MTd)
If that's not enough, there's more at following page: https://social.msdn.microsoft.com/Forums/en-US/841e5723-bce4-4340-b7b3-027dcdf90f00/

Unresolved external symbols in compiling 32 bit application in Windows 64

So I am trying to compile legacy app from 32 bit to 64 bit..
I re-compiled all of the libs it used and made it look into WIN SDK6.0A x64 bit for libs..
I am using:
Visual Studio Professional Edition 2008
Visual C++
dotNet Framework 3.5 SP1
Windows Server 2008R2
Windows SDK is 6.0A
Everythings finally coming up but I am getting these weird undefined symbol errors:
error LNK2019: unresolved external symbol InterlockedDecrement referenced in function ...
error LNK2019: unresolved external symbol InterlockedIncrement referenced in function ...
error LNK2019: unresolved external symbol GetModuleBaseName referenced in ...
error LNK2019: unresolved external symbol EnumProcessModules referenced in ...
error LNK2019: unresolved external symbol EnumProcesses referenced in ...
error LNK2019: unresolved external symbol GetProcessMemoryInfo referenced
The problem is these are all win stuff from SDK.
InterlockedDec and InterlockedInc are coming from kernel32.lib
GetModuleBaseName, EnumProcessModules, EnumProcesses,GetProcessMemoryInfo are in psapi.h but also kernel32.lib or psapi.lib
I checked C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64 and both libs
kernel32.lib and psapi.lib are there.
It definitely looks up the libs at right spot. I turned on /VERBOSE:LIB
and it points to the correct folder.
So I am really confused why isnt it finding them.
Any ideas???
Thanks
So I finally figured it out, kinda...
It wasnt finding psapi.lib
In Project->Linker->Additional dependencies instead of just saying psapi.lib
I gave full path to it and it worked...
not really sure why it failed to find it before but oh well...
This is very long shot (and I don't really believe this is it) but maybe the headers are not properly guarded with extern "C" for c++ compilation? Are you including system headers or just declaring the functions yourself?
Can you post your compile and link command lines, and any #def's in your code?
Does this happen if you make a simple project from scratch that only calls one of those methods?
For the record: Same problem, different solution;
I had an entry for the directory
psapi
added in the list of
Linker/General/Additional Library Directory
This resulted in the usage of the old VS2005 platform sdk psapi.lib (it only had x86, no x64 version).
After removing the entry the correct lib from the installed WinSDK x64/psapi.lib is used now.
So keep an eye out for mixings/ordering of old & new SDKs!
Obviously the full path will also work but might be a problem when you use the project on multiple machines.
In my case(migrate from VS2008 to VS2012), issue solved after adding psapi.lib in Linker->input->Additional Dependencies in VS 2012.

Setting up visual studio c++ 2008 with mysql c api

I'm wondering if anyone can help me on getting my visual studio c++ project setup correctly to work with MySql?
I downloaded and installed MySql Server, and installed the developer content with the include files, but beyond that I'm a bit lost.
I tried adding the 'include' directory in my MySql install path to my additional includes directory, which allowed me to access the includes I needed, but left me with unresolved external symbol errors.
1>Main.obj : error LNK2019: unresolved external symbol _mysql_error#4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _mysql_real_connect#32 referenced in function _main
Any help would be greatly appreciated.
Sounds like the library isn't being included. The first thing I would look at is Additional Dependencies. You can either set it programatically or in Visual Studio (Solution->Properities->Configuration Properties-> Linker
You may need to include the library under "additional library directories" in that same area.