How to set up [ ZeroMQ ] for use in a Visual Studio 2015 Enterprise? - c++

While my primary domain of expertise is not Visual Studio 2015 setup / project configuration, I have experienced troubles on loading / configuring ZeroMQ project.
How to proceed correctly on loading a ZeroMQ Project?
Observed errors:
current build on github and even old "stable" versions cause cmake errors
ZeroMQ Installer does not support Visual Studio v14
Instructions would be awesome, as it seems that there is no other source of documentation for this situation on the internet.

Had the same problem a while ago. Here is what I did to solve this:
Download the right ZMQ version
The "download link" provided on the ZMQ website seems outdated.
To really get the current version you would have to use Git:
git clone https://github.com/zeromq/libzmq.git
Build with Visual Studio 2015
The repository comes with a pre-build Visual Studio project. You can find it in ...\libzmq\builds\msvc. To build for Visual Studio 2015 cd into vs2015 and open libzmq.sln.
You can choose if you want to compile static or dynamic libraries: DynRelease or StaticRelease for either Win32 or x64.
After that, run Build > Build solution to compile everything.
Setup project to use compiled libraries
After you created your project, go to the project's properties:
C++ > General > Additional Include Directories should point to the include path of the repository. If you want to use C++ style some additional files have to be placed in this directory. Alternatively you can take a look at https://github.com/zeromq/zmqpp.
Linker > General > Additional Library Directories should point to the built libraries. They should be located at ...\libzmq\bin\x64\Release\v140\dynamic\.
Linker > Input > Additional Dependencies should contain the name of the library you want to use. The default should be libzmq.lib, otherwise you will find the name in the bin directory.
The program depends on the libzmq.dll file you just built. This file has to be placed within your project's build directory. To achieve this, you can add the following command to Build Events > Post-Build Event > Command Line:
copy /Y "...\libzmq\bin\x64\Release\v140\dynamic\libzmq.dll" "$(OutDir)"
This will copy the .dll file to the destination directory on every build if it's missing.
Hope this helps =)

Related

Point Cloud Library with Visual Studio 2017

I'm having trouble using Point Cloud Library with Microsoft Visual Studio 2017.
I have installed [PCL-1.8.1-AllInOne-msvc2017-win64.exe] and I've followed the steps mentioned
here. to link it to my Visual Studio 2017 project.
My problem is that Visual Studio is not finding the header nor the source files of the library I need.
The error I'm getting is as follows:
[fatal error C1083: Cannot open include file: 'pcl/io/pcd_io.h': No such file or directory]
To be more precise about my problem, I need to include three PCL header files in order to run thisIterative Closest Point Tutorial
I've followed the following steps to include the PCL into my project:
Added the include directories to my project at the Project Properties/Configuration Properties/VC++ Directories/Include Directories field - here I specified the path to my PCL/include directory and to all 3rd party include directories (PCL/3rdParty)
Added the library directories on the same settings page (Library Directories field) - hereI specified the path to my PCL/lib directory and to all non-header-only 3rd party libs (Boost, Flann, VTK)
Chose the libs to be used in the linker. In Project Properties/Configuration Properties/Linker/Input/Additional Dependencies field. I added all the libs required. As I'm trying to run it in debug mode for now, I've picked the "_debug.lib" library files.
Finally, I've added the PCL/bin folder to my system path variable.
Does anyone know if I'm missing something configuration-wise?
I've seen several old posts about incompatibility between older Point Cloud Libraries and older versions of Visual Studio. As far as I understood, the new versions are supposed to work well together, but it's not the case for me.
Installing pcl is tough because there are dozens of dependencies used along with pcl software. But with with vcpkg,a command line package manager, the installation becomes just like a one liner command.
Use Microsoft vcpkg to build a static or dynamic library for your project automatically. All the dependencies like boost,tiff,openssl,flann,szip,etc will be downloaded and installed by itself. After installing vcpkg type the following on Powershell.
.\vcpkg install pcl:x64-windows-static
The link you referenced is 3-4 years old. At the time, any binary build of PCL for Visual Studio 2012 or later was not provided, and thus. PCL needed to be built with target VS. And every include/library directory of PCL and any related library have to be manually added to setup the IDE. Since PCL is a large-scale collection of libraries, this made it difficult for its users to setup VS.
Now early 2018, binary builds of PCL for VS 2015/2017 and more automatic way to setup VS (e.g., adding library/include directories) using CMake are provided. Thus, installing PCL and creating a VS project using PCL does not take more than 10 minutes. I think you'd better follow the recommended way rather than setting VS by yourself.
the previous answer use vcpkg is good,but is better to use:
.\vcpkg install pcl:x64-windows
It can let you have fewer problems.
A small note for anyone who has issues with the install listed above, occasionally an install will get corrupted and not work. I got:
LINK : fatal error LNK1201
on a build, and the solution for that is find the downloaded item. This will be located in the vcpkg/downloads/ directory. Delete the item that was having issues and try the install again.

Visual C++ nuget: boost include files not found

I'm pretty new to visual studio as I usually work in linux.
I installed boost package via nuget and I can see all the headers files installed correctly into my solution's 'packages' folder.
However whenever I try to include a boost header I get an error, e.g:
Cannot open include file: 'boost/type_traits/has_equal_to.hpp': No such file or directory
At the same time I installed SFML libraries and those work perfectly.
Also I noticed, that in my project properties, 'Referenced Packages' section SFML libraries are listed, but boost ones are not. This is strange, because when I installed the packages I did click the checkboxes for the projects I installed the packages for.
I tried hard to find how to add package references but miserably failed. I'm probably just being thin here...
I'm using Visual Sudio 14 (2015) Update 3 Community Edition.
You need to add the following path:
$(SolutionDir)\packages\boost.w.x.y.z\lib\native\include\boost
in Configuration Properties > C/C++ > General > Additional Include Directories

cURL with Visual Studio 2013

So i have came along with cURL as a very nice library and working very fine in OSX.
But on windows now i have got big troubles with getting ready with this library. I googled now for about 2 days and tried over a dozen (in detail) different ways to get this ready. Without any success at all.
Here are some ways I basically tried:
The direct Download: The problem here already starts with the right download. The official download page is pretty confusing, so i considered this "cURL Download Wizard" > "libcurl development" which gives me a version, that i should be able to include into any project. But how exactly to include it? In ANY instructions out there it leads me to directories i dont even have. Almost always this "curllib.lib" is mentioned. I downloaded about 6 different versions on that downloadpage, in none of them there is this file. (See for example this instruction)
Git + CMake: As a solution on the aboves Link there is suggested to use git clone on this. I did all the instructions there and also get the Projects generated with just warnings. But here it says as well:
After building install target, your will find bin/include/lib folders in C:\curl.vc12 Well, i did not really get his point of "build install target", i just build the entire project map as it comes. Compiles fine (115 succeeded, 0 failed, 2 skipped). But now C:\curl.vc12 is not there. What do i have to pre-setup before compiling this?
NuGet: The idea comes from the link in point (1) again, a different solution with NuGet.
With Successfully added 'curl 7.30.0.2' to test. it also seemed nice, but compiling simple.c leads to a bunch of unresolved external symbol linker errors. But a solution is provided:
Make sure the include directory and lib directory are specified under the Visual C++ directories in project properties.
So in Project > Properties > VC++ Properties > "Include Directories" and Project > Properties > VC++ Properties > "Library Directories" as well as in Project > C/C++ > General > "Additional Include Directories" and in Project > Linker > General > "Additional Library Directories" I desperately added the \packages\ path from my project folder.
As mentioned in the instructions, I added libcurl.lib;libeay32.lib;ssleay32.lib;Ws2_32.lib;libssh2.lib;zlib.lib;wldap32.lib; to Project > Linker > Input > "Additional Dependencies".
All that done, the unresolved external symbol errors are gone! Therefore I get just one error saying cannot open file 'libcurl.lib'. What can I do here?
I am pretty new to all that. But I am trying really hard now to get this finally to work. So what can I do?
I work with Visual Studio 2013 Community Edition. The currently most recent version of cURL is 7.42.1.
Any help is highly welcome!
Had problems myself, finally got it working now.
I downloaded curl-7.42.1.zip from the official website.
Within the archive you'll find the source code and winbuild/BUILD.WINDOWS.txt, which basically contains the instructions I followed. I'll assume that it has been unzipped to C:\curl-7.42.1.
Open the Visual Studio command prompt located at
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts
This automatically sets the environment variables needed to use Visual Studio tools like the compiler. Then move to the winbuild directory and call
nmake /f Makefile.vc mode=dll
as described in the text file I mentioned above.
That will create the directory
C:\curl-7.42.1\builds\libcurl-vc-x86-release-dll-ipv6-sspi-winssl
containing libcurl.dll, libcurl.lib and the necessary header files. Let's rename it to C:\curl-7.42.1\builds\release :'D
Then open your project.
Open your project's properties.
Make sure you choose Release as configuration (top left corner)!
Navigate to VC++ Directories > Include directories and add C:\curl-7.42.1\builds\release\include
Add C:\curl-7.42.1\builds\release\lib to VC++ Directories > Library directories.
Go to Linker > Input > Additional Dependencies and add libcurl.lib.
Finally copy C:\curl-7.42.1\builds\release\bin\libcurl.dll to your project folder.
That should do the trick! :D If you want to use cURL in debug mode, you can do almost the same, recompile using nmake /f Makefile.vc mode=dll debug=yes, go to your project's properties, add the newly created directory paths (changing libcurl.lib to libcurl_debug.lib) and you should be done.
I had the same issue. I downloaded the curl from https://github.com/curl/curl. you can actually compile it directly with Visual Studio 2013 (but be careful with parameters setting: x64 with release). The major difference is that it gives you libcurl_imp.lib. Then all you have to do is to set the environment variables as described above. Just want to mention, you will have to use libcurl_imp.lib rather than libcurl.lib in the additional dependencies (I suspect this change is because of the new version of curl).

MySQL Connector C++ 64bit build from source in Visual Studio 2012

I am trying to build the mySQL Connector C++ from source in Visual Studio 2012 for the 64-bit architecture.
I understand that it depends on some boost header files and the C connector.
Running CMake produces a project file, but that project file doesn't compile because of a big list of very confusing errors which probably have to do something with the include files, and an even bigger list of warnings. The official site is of little help.
Could some one please list all the steps in successfully compiling the C++ Connector?
In order to build it you need to have the following:
You need to have installed either the MySQL server or the MySQL C Connector.
Have installed the Boost C++ libraries or have the source files for it. Please note that there is not need to build boost as you only need the header files.
Have CMake installed. When installing CMake it will ask you if you want it included in the PATH variable, you should select yes to make it easier later to use it.
Once you have all three available, open VS2012 x64 Native Tools Command Prompt and from the source root directory of the MySQL C++ Connector you need to issue the following:
set MYSQL_DIR=c:\PROGRA~1\MySQL\MYSQLC~1.1
cmake -G "Visual Studio 11 Win64" ^
-DBOOST_ROOT:STRING=C:\Users\user\DOWNLO~1\BOOST_~1\BOOST_~1 ^
-DMYSQL_LIB_DIR:STRING=c:\PROGRA~1\MySQL\MYSQLC~1.1\LIB
devenv.com MySQLCPPCONN.sln /build Release
The first command defines the MYSQL_DIR variable that points to the installation of the MySQL server or the MySQL C Connector.
The second command call cmake to prepare a VS project that will be 64bit. There seems to be a problem with the MYSQL_LIB_DIR variable and it does not get generated, so we need to define it manually. MYSQL_LIB_DIR has the value of MYSQL_DIR ending with a \LIB.
Third command is optional, it will build the project from command prompt without opening VS.
It is recommended that you use the DOS paths for the variables.
To do that, navigate to the directory you want to convert to DOS path and call for %I in (.) do echo %~sI. It will give you the converted path.
It's really tough task and I've spent lot of hours figuring this out.
There are two issues here:
C++ Connector and MySQL libraries they have provided have been generated with Visual Studio 2010. Hence we can not use them as it is under VS2012 (It gives version mismatch error)
They also have not specified exact compiler options under which they have compiled these libraries. If our compiler settings are different, we'll end up in lots and lots of (especially linker related) errors.
Considering these facts, the only way is to build ourselves these libraries. Building MySQL is quick but building connector is little complicated.
Here are steps I am sharing. In my case I wanted to link these libraries statically with my project so I built these libraries accordingly. You may want to make relevant changes wherever necessary as per your need.
Before continuing with these steps, please download and install CMake on your system.
Steps to build MySQL server:
Download MySQL source. Extract them. Go in extracted folder in command prompt.
Create BLD forder
Go in BLD folder through command prompt
Run
cmake .. -G "Visual Studio 11 2012 Win64"
It will create MySQL.sln
Open MySQL.sln in Visual Studio and build only 'mysqlclient' library (as only this would be needing by application)
This will build libraries in mysql-5.6.24\BLD\libmysql\< Configuration > folder which we link in our project.
Steps to build C++ connector:
Download mysql-connector-c++ source. Extract it. Go in extracted folder in command prompt.
Create BLD forder
Go in BLD folder through command prompt
Run this command (Make sure we've built MySQL server before this, in Release and Debug mode. Also make sure we've downloaded Boost sources)
cmake .. -DMYSQL_INCLUDE_DIR="..\..\mysql-5.6.24\include" -DMYSQL_LIB_DIR:STRING="..\mysql-5.6.24\BLD\libmysql\Release" -DBOOST_ROOT:STRING="..\Boost\boost_1_54_0" -DMYSQL_CLIENT_STATIC_LINKING=1 -G "Visual Studio 11 2012 Win64"
It will create MYSQLCPPCONN.sln
Open MYSQLCPPCONN.sln in Visual Studio and make changes to 'mysqlcppconn-static' project:
A. Under C/C++ -> General -> Additional Include Directories put this (for All Configurations)
nativeapi;..\;..\..\;..\cppconn;..\..\cppconn;..\..\..\mysql-5.6.24\include;..\..\..\mysql-5.6.24\BLD\include;..\..\..\Boost\boost_1_54_0
B. In Code Genaration, change Runtime Library to Multithreaded (Debug or non-Debug depends on configuration) and NOT DLL
C. Under Librarian -> All Options keep "Additional Options" and "Ignore Specific Default Libraries" to blank (for All Configurations)
D. Under Librarian -> General keep "Ignore Specific Default Libraries" to blank (for All Configurations)
Build only 'mysqlcppconn-static' library project (as only this would be needing by application to connect to MySQL server)
This would generate library in mysql-connector-c++-1.1.5\BLD\driver\< Configuration > folder which we link in our project.

Getting LibCurl to work with Visual Studio 2013

I am having trouble getting LibCurl to work with Visual Studio 2013. I downloaded the current version (curl-7.33.0) and tried following the instructions I found on this site: Using LibCurl with Visual 2010
But I can't find curllib.lib in the folder I downloaded. And I am still getting errors:
After searching the internet for more help. I now get these error messages. There appears to be a problem with linking to libcurl.lib?
This is what I have configured:
Inside /lib I have libcurl.lib and libcurl.dll
UPDATE
I downloaded this release for Win32 MSVC: http://curl.haxx.se/download.html#Win32
After adding the libcurl libraries and successfully compiling, I am now getting this error message:
The application was unable to start correctly (0xc000007b). Click OK to close the application.
Here is the sample code I am trying to run:
#include <iostream>
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
FINAL UPDATE
I believe I have gotten LibCurl to work with Visual Studio 2013 now. Persistence ftw!
Although, after spending hours trying to solve these error messages, I am a little hesitant at saying everything is working fine now. That is why I am putting a bounty on this question to get clear and concise instructions on getting LibCurl to work with Visual Studio 2013.
This is what I did to get it to work:
First, download the Win32 MSVC package here: http://curl.haxx.se/download.html#Win32
For these instructions sake, let's say you downloaded to C:\LibCurl
Start a new project in Visual Studio. Go to Project|Project Properties|VC++ Directories|Include Directories|
Add the path to the include directory inside the downloaded package. (C:\LibCurl\include)
Next, go to Project|Project Properties|Linker|General|Additional Library Directories|
Add the path to the lib directory. (Where curllib.dll is located)
Then, go to Project|Project Properties|Linker|Input|Additional Dependencies|
And add curllib.lib
Now if you compile a test program, you will likely get the message saying libsasl.dll is missing. You will need to download this file and put it in the same directory as your build.
I used 7-Zip to extract libsasl.dll from OpenLDAP for Windows. OpenLDAP for Windows
This is the result of my test code from above:
A lot of these instructions are out of date because they recommend the win32-ssl-devel-msvc package for curl, which no longer exists.
The following instructions allow you to build libcurl using only:
Visual Studio 2013
curl generic source tarball (tested on curl 7.44.0).
A. Build libcurl static library
Download the latest curl generic source from: http://curl.haxx.se/latest.cgi?curl=tar.gz
Extract the source to a local directory (we'll be using C:\libcurl)
Open a command prompt
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat" To initialize your VC environment variables (adjust your VS 2013 installation directory as needed)
cd C:\libcurl\winbuild
nmake /f Makefile.vc mode=static VC=12
The build should appear in C:\libcurl\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl
B. Link Against libcurl in Visual Studio
In Visual Studio, right click your project in Solution Explorer, then click "Properties"
Configuration Properties > C/C++ > General > Additional Include Directories: add C:\libcurl\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\include
Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions: add CURL_STATICLIB
Configuration Properties > Linker > General > Additional Library Directories: add C:\libcurl\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib
Configuration Properties > Linker > Input > Additional Dependencies: add libcurl_a.lib
C. Call libcurl from Your Project
The following sample shows a call to libcurl:
#include "stdafx.h"
#include <curl/curl.h>
void main(int argc, char* argv[])
{
CURL *curl = curl_easy_init();
if (curl) printf("curl_easy_init() succeeded!\n");
else fprintf(stderr, "Error calling curl_easy_init().\n");
}
I would say that in a comment, but I am lacking in points.
You don't have to copy any .dll into your program run catalog.
Go to Project | Properties | Configuration Properties and in line Envrionment write: PATH=$(ExecutablePath)$(LocalDebuggerEnvironment).
From now on, all .dlls from any catalog you mention in Project|Project Properties|VC++ Directories|Binary should be usable without copying them.
The rest is exactly as you written.
The easiest way to do this that I found is first make sure that nuget is installed.
http://www.nuget.org/
Then create your project.
Then go to http://www.nuget.org/packages/curl/ and follow the instructions which is to go the package manager console and type PM> Install-Package curl
If you then look for the packages directory in your project directory, you will find the include files and the library files. Note that there is a version for Visual Studio 110, not 120, but because libcurl is a C library you can use it with Visual Studio 2013. Make sure the include directory and lib directory are specified under the Visual C++ directories in project properties.
Make sure you have the following files as addition input to the linker
libcurl.lib;libeay32.lib;ssleay32.lib;Ws2_32.lib;libssh2.lib;zlib.lib;wldap32.lib;
Another way to use curl/libcurl is build with CMake v2.8.12+ (assuming that git is already installed on your computer)
Open cmd window and change dir to appropriate folder
git clone https://github.com/bagder/curl.git
mkdir msbuild
cd msbuild
cmake ..\curl -G"Visual Studio 12 Win64" -DCMAKE_INSTALL_PREFIX=C:\curl.vc12 -DCURL_STATICLIB=ON
< ... lots of output here ... >
Open generated CURL.sln in Visual studio and build it.
CMake options I use in example
-G selects build generator. In our case Visual Studio 2013 64 bit target
-DCMAKE_INSTALL_PREFIX - provides root folder where targets should be installed
-DCURL_STATICLIB=ON - generates build for static library
After building install target, your will find bin/include/lib folders in C:\curl.vc12
Provide those path to your solution and build your code with curl lib.
I tried to do it from scratch with VS2012 (I don't have 2013) and it works perfectly.
I downloaded version 7.19.3 from http://curl.haxx.se/latest.cgi?curl=win32-ssl-devel-msvc because it's the only available version for VS.
I added the include directory, not the curl directory as he says in the tutorial.
I compiled a small toy project without any problem.
So, I'm not sure what your problem is, but:
Make sure you download the right archive.
Try to put the cURL folder on a path without space.
If you know someone who use VS2012 or older, try your code with the same include and lib and see if it works.
Paste a minimal working example of your code so I can test it.
This is a bit late, but for those who still have problems, this method worked best for me:
Add VS to the system PATH:
For example: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin.
Download current curl-X.zip from http://curl.haxx.se/download.html and unzip.
Open command line at curl-X/winbuild.
Call vcvars32.bat.
Call nmake /f Makefile.vc mode=static VC=12.
Goto curl-X/builds/libcurl-XXX.
There you find the includes and a libcurl_a.lib.
This lib works fine for me.
Remember to define -DCURL_STATICLIB when you compile your code with this lib.
For Visual Studio 2017, the steps in link worked for me. In case the link expires or specifically for those who download the libcurl zip file instead of cloning from GitHub, I will note down the steps here.
Set environment variables with “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat” x64. If the command is successful, you will see a message that says Environment initialized for 'x64'
Download and extract the compressed libcurl file from download libcurl. I used the .zip file.
cd into winbuild directory inside the extracted libcurl folder.
Run nmake /f Makefile.vc mode=dll MACHINE=x64 to build. For more information on build options, please refer to BUILD.WINDOWS text file in winbuild folder.
Go up one directory level and cd into builds folder to find the compiled files.
All the best!
The problem is that the targets for the default VS2013 platform tools are not set in the NuGet packages. This is why it works in VS2012 but not VS2013. I manually created replacement targets files. Instructions and download:
https://github.com/evoskuil/curl-nuget-targets
Download the curl v7.37.0 source code and use the Visual Studio project files provided.
I've spent the last few weeks polishing my own personal project files, that were based off the original VC6 files, and adding them to the repository.
.dsw / .dsp (VC6), .sln / .vcproj (VC7, VC7.1, VC8 and VC9 as well as .sln / .vcxproj (VC10, VC11 and VC12) files are provided for both DLL and Static Library builds with support for OpenSSL and Windows SSPI / SChannel in both Win32 and x64 configurations.
I found an easy way to get it work in VC++ using the latest package. I basically followed the steps in Using libcurl in Visual Studio. The libcurl and VC++ are very old in the instruction.
First download the ZIP file on download page https://curl.haxx.se/download.html The ZIP package is https://curl.haxx.se/download/curl-7.50.1.zip
Go to projects-> Windows\VC10 (or your version of VC)\lib\libcurl.sln, open the project in VC++.
Build the project in DLL Release. DLL debug doesn't work on my VC++.
Go to build\Win32\VC10\DLL Release, you can find the lib and dll files generated from previous step.
Create a folder new, with include and lib folders. Copy the libcurb.dll and libcurb.lib whatever is in the DLL Release folder to the new\lib. Copy everything in curl-7.50.1\include to new\include folder.
C++ Properties -> Configuration Properties -> VC++ Directories, add new\include to Include Directories, new\lib to Library Directories; add new\lib to Linker -> General -> Additional Library Directories, add libcurl.lib to Linker -> Input -> Additional Dependencies
It seems that I have to put the dll file under the same folder with executable file.
It should work.