Visual Studio 2015 OpenSSL - c++

I was trying to #include <openssl/hmac.h> in my C++ app. So I tried to follow this instructiosn:
http://www.askyb.com/windows/compiling-and-installing-openssl-for-32-bit-windows/comment-page-1/#comment-47532
I succesfully did this much:
Create a new folder C:\openssl-1.0.1c
Downloaded 1.1.0c from github - https://github.com/openssl/openssl/tree/91eaf079b7430cb4ebb7f3ccabe74aa383b27c4e
Extracted it to C:\openssl-1.0.1c
I downloaded and installedinstall ActiveState Perl
Added C:\perl\bin to my path like this in my screenshot - http://i.imgur.com/QOhKUwl.png
Create a new folder C:\openssl-1.0.1c-bin
Opened command prompt with Win+R then typed cmd
Then pasted with quotes "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat", which is the correct path, it exists on my system
It ran then I did perl Configure VC-WIN32 no-asm – -prefix=C:\openssl-1.0.1c-bin (no quotes), it told me to ppm install dmake to get nmake so I did that - http://i.imgur.com/SuC65oo.png
I typed nmake as per this issue - https://github.com/curl/curl/issues/1002 - it is no longer possible to do nmake -f ms\ntdll.mak, this took like 15minutes
It worked then I did nmake test
All tests passed, however my C:\openssl-1.0.1c-bin directory is empty and doing #include <openssl/hmac.h> is not working my visual studio.
I'm a newbie to writing c++.
Thanks

You missed a step at the end, Run this command “nmake -f ms\ntdll.mak install”. It will copy all the libraries to C:\openssl-1.0.1g-bin.
If you do that it will work as expected. I just tried it locally with windows 7 and visual studio 2015 and it worked fine.
The warning about nmake is spurious you can continue using nmake ok.

Related

Cocos 2d x not generating libcoco2d.vcxproj or libspine.vcxproj

My config:
Windows 10, python 2.7, Visual Studio 2015 community
I downloaded cocos, I successfully run setup.py
Then I proceed to execute "cocos new -l cpp -p com.whatever.Test -d D:\Projects\Cocos\Test".
Everything seems to run ok, no error message whatsoever. If I go to my folder, I can see all the project folders etc.
I open the sln file within Win32 and it opens the project in visual studio 2015.
Here comes the problem: the solution has 6 projects. 2 of them are not loading and, as a consequence, the main project fails. The failing projects are libcocos2d and libspine. There are no project files generated in their respective folders, so VS can't find the required libcoco2d.vcxproj or libspine.vcxproj.
I'm lost here people, I don't have a single clue on what do I have to do to generate both projects.
Any help will be very much appreciated.
Thanks
I found what was wrong. The cocos.py script, at some point, calls CMake. I downloaded CMake and I built the projects using that. It failed. Then I realized that CMake was using the wrong compiler. Even having Visual Studio 2015, the correct compiler is Visual Studio 2014, not Visual Studio 2015 (Thanks a lot M$...). Then CMake was working. After that I tried the script again, and everything is perfect now.

trying to include curl library, Get the following error from nmake: windows.h file not found

My System information : Windows Server 2008 R2 Standard, 64 bit
I am trying to use Curl(http://curl.haxx.se/) Library with my c++ code(Visual Studio MFC). I'm trying to build libcurl.dll from the curl source using nmake (Visual Studio 10). I need to run the following command from Visual Studio Command Prompt:
nmake /f Makefile.vc mode=dll
I get the following error:Error
Thanks to mikedu95, I was able to solve this.
Follow instruction from curl.haxx.se/docs/install.html ("MSVC IDE" in my case)
Then Follow:Getting LibCurl to work with Visual Studio 2013
This will setup everything you need

Qt Windows x64 build succeeds in IDE but not on the command line

I have a Qt project I'm trying to automate. On Windows I build for both 32-bit and 64-bit platforms. I am using Visual Studio 2013. I have the following Qt Kits installed: Desktop Qt 5.5.1 MSVC2013 32bit, and Desktop Qt 5.5.1 MSVC2013 64bit. All four versions (32-bit debug and release, and 64-bit debug and release) can be built and run without any trouble from the IDE. Unfortunately, building from the command line fails with this error:
fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
My command-line system, intended for eventual use in a batch file, and run in my project directory, is:
pushd Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
call vcvars32.bat
popd
md build64
cd build64
G:\Qt\5.5\msvc2013_64\bin\qmake.exe -spec win32-msvc2013 -o Makefile ..\Maps.pro
G:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release
I use this command in a command window (after setting up the path using vcvars32 so that the Visual Studio tools like nmake, rc and link can be found) and get the error. Note that the command-line method works perfectly for my 32-bit build.
The qmake command line I use is copied from the one recorded in a comment in the Makefile created by the IDE, which claims it is the command used to create that makefile. I know that the "-spec win32-msvc2013" option looks strange, but it works when the IDE uses it.
The jom command line I use is the one used by the IDE, as logged by the Compile Output window.
The only thing I can think of is that Qt sets up some 'magic' environmental variables which I don't know about.
[Yes, I have googled very extensively and looked at other questions and answers here, and can't find anything that fits this case.]
This code
pushd Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
vcvars32.bat
popd
sets up environment for building for 32-bit architecture. Run vcvars32.bat from different directory (I think it should have amd64 in its name, don't have Windows computer at the moment so can't say the exact directory name, but you'll figure out).
Or do
pushd "<DRIVE>:\Program Files (x86)\Microsoft Visual Studio <Version>\Common7\Tools"
vsvars32 x64
popd
Update for VS2017:
For 64-bit architecture use this command:
"<DRIVE>:\Program Files (x86)\Microsoft Visual Studio\2017\<Version>\VC\Auxiliary\Build\vcvars64.bat"
and for 32 bits:
"<DRIVE>:\Program Files (x86)\Microsoft Visual Studio\2017\<Version>\VC\Auxiliary\Build\vcvars32.bat"

How to build a QT-project in visual studio from command line

I am trying to automate the build process for one of my QT-project. I used the following command in my batch file for non-QT projects
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" "myproject.sln" /build "Debug|x64" /projectconfig Debug
but it is not working for my QT project. Am I missing something?
Here is an example on how to do that (command by command):
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
cd <my_project_directory>
qmake
nmake
The first command sets up the environment for using Visual Studio tools.
Second command changes the current directory to one where your Qt project file is (you have to have one).
Third command runs Qt's qmake.exe utility to generate make files.
And finally nmake will build your project.
However, if you don't use Qt project files and have only VisualStudio solution, you can use MSBuild utility, like:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
MSBuild your_solution.sln /p:Configuration=Debug
You can also set additional environment variables, such as QTDIR if it does not find your Qt installation.
If somebody finds this question looking for an answer on how to automate the build process of a QT project, and wants to do it using a BATCH file as the original question states, here is the BATCH script that I used to automate my building process:
#echo off
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
cd %path_to_your_repo%
nmake /f Makefile.Release clean && qmake.exe %path_to_your_.pro% -spec win32-msvc "CONFIG+=qtquickcompiler"
nmake qmake_all
nmake -f Makefile.Release
It is important to call the vcvarsall.bat the first thing, as this will set the environment for all visual studio tools. Also make sure to launch it with call, if you just start the batch file as in #vahancho's answer it will stop your script after executing vcvarsall.bat.
The clean step is not necessary but it is a good practice to use it before building.
It is important to select the -spec and CONFIG (if any) during the qmake step, as this will allow you to select the compiler and required configuration if you are using some extra QT configuration.

How to build libevent version 2.0.10 with Visual Studio 2008

Does anyone have clear instructions on building libevent-2.0.10 with Visual Studio 2008?
Use the Visual Studio Command Prompt, then
cd \where\you\put\it
nmake -f makefile.nmake
Or if you prefer the IDE, then File + New + Project, Visual C++, General node, pick the Makefile Project template. Name = libevent-2.0.10-stable, Location = parent directory (\where\you\put). OK. Next. Build command = nmake -f makefile.nmake, rest blank.
Don't forget to run vcvars32.bat before nmake to set up the environment variables for VC.
If you are using the GUI to build it, do not check the option "Create directory for solution" when creating the project.