I have built openssl static libraries(libeay32.lib and ssleay32.lib) with openssl source code using VC++ compiler. I use them in a VS2010 project and they works well.
#pragma comment( lib, "libeay32.lib" )
#pragma comment( lib, "ssleay32.lib" )
Then problem is I want to debug the source code of openssl libraries in VS2010(step into, step over...). For example, set a breakpoint in the openssl api and then step into the openssl source file. how can I achieve that?
I have tried to use VS compiler option 'Zi' to generate some .pdb files when building openssl static libraries, but I don't know how to use them. I tried to add the path of those .pdb files in Option->Debugging->Symbols->Symbol file location, but seems it doesn't work.
See Jared's answer at How to debug external class library projects in visual studio?. In short:
Debug -> Windows -> Modules
Find the DLL for the project you are interested in
Right Click -> Load Symbols -> Select the Path to the .PDB for your other project
Also, make sure the PDB files are in the same directory as libeay32.lib and ssleay32.lib.
Finally, if you are really having trouble, try Thomas Hruska's The Win32 OpenSSL Installation Project. Thomas prebuilds everything for you and packages it in a Windows installer.
Related
I use VCPKG to build third party libraries like libcurl for example. I have dynamic and static builds. Obviously, import .lib and object .lib files are contained in two different folders, x64-windows and x64-windows-static respectively.
I want to link object libcurl.lib statically with my program, but cannot figure out how to configure Visual Studio to do it. It always ends up using the import lib, rather than object lib and thus my program ends up requiring libcurl.dll at execution.
I have configured the main project to use /MT runtime library.
I have tried configuring linker to use additional libraries folder pointing to the static lib folder and additional dependencies.
I have even tried using full path to the object libcurl.lib file in linker additional dependencies.
When I us /MT switch for runtime libraries, I can tell by using Dependency Walker that all the regular libraries like vcruntime are integrated in the executable, not loaded as DLLs, but libucurl.dll is still there, loaded dynamically.
It seems that due to VCPKG automatic include path integration, Visual Studio always finds and uses the import libcurl.lib first, even if I specify the full path of the object libcurl.lib in linker inputs.
How do I configure Visual Studio to statically link the right .lib file?
OK, I found the solution for anyone who might have the same problem.
By default, Visual Studio uses x64-windows, or x86-windows "triplet"
You can see the automatically deduced triplet by setting your MSBuild verbosity to Normal or higher:
Shortcut: Ctrl+Q "build and run"
Tools -> Options -> Projects and Solutions -> Build and Run -> MSBuild project build output verbosity
To override the automatically chosen triplet and use x64-windows-static or x86-windows-static, you can specify the MSBuild property VcpkgTriplet in your .vcxproj by adding this to the Globals PropertyGroup.
<PropertyGroup Label="Globals">
<!-- .... -->
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
</PropertyGroup>
https://github.com/microsoft/vcpkg/blob/master/docs/users/integration.md#with-msbuild
I've downloaded a copy of Expat 2.0.1, which is basically a bunch of .h and .c files (see the complete directory in the screenshot below).
To add the library to the VS 2013 project I'm working on, I went to Properties -> Configuration Properties -> VC++ Directories and added the path of the 2.0.1 folder shown in the screenshot to the "Include Directories" field. This gets rid of all the intellisense errors, but when I build the project I get a bunch of linker errors that are complaining about unresolved symbols (eg XML_ParserCreate, which is a function from the Expat library). I can right-click on these symbols and peek the definition, so it seems like everything is "hooked up" correctly. How can I get the linker to stop complaining? There doesn't seem to be any libraries I can add to the Linker section of the configuration. Do I need to use Makefile.MPW somehow?
This is just the source, you have to create the library yourself, see MicrosoftDocs. BTW MPW is a Mac file.
i've just downloaded cumulus, POCO, OpenSSL and LuaJIT and visual studio. now i'm trying to compile it as it said in instruction here
however i've never used visual studio and i've never programed on visual c. so i'm stuck at the very begining.
in instruction i've put link above said "Visual Studio 2008/2010 solution and project files are included. It searchs external librairies in External/lib folder and external includes in External/include folder in the root Cumulus folder. So you must put POCO, OpenSSL and LuaJIT headers and libraries in these folders.". i tryed everything but compiler can't find 'Poco/foundation.h'.
and it seems to me if i deal with this error there will more over.
so if someone has expirience in compiling cumulus-server please help me to deal with it.
thanks a lot for you help!
step 1 - create 2 files
cumulus_root_folder/external/lib
cumulus_root_folder/external/include
step 2 - put the headers into the include folder from the other 3 dependent projects
dependent projects are: openssl, poco, luajit.
put openssl file into the external/include from openssl-version/include
put Poco file into the external/include from poco-version/Foundation/include
put SAX, DOM, XML files into the external/include/Poco from poco-version/XML/include/Poco
put Net file into the external/include/Poco from poco-version/Net/include/Poco
put Util file into the external/include/Poco from poco-version/Util/include/Poco
put LuaJIT's headers with the same way.
now you can build cumuluslib.
step 3 - Open your cumuluslib project with specific visual studio version then build it.
When it's done you can see the lib file at cumulus_root_folder/cumuluslib/lib
step 4 - now you have to build the 3 dependent projects and put their lib files to cumulus_root_folder/external/lib its tough mission, maybe you will need 32-bit windows. Do not forget: when you building poco, do it with debug if not, some of your files will be missing.
When you done with building and gathering lib files you can build cumulusserver. Same way as cumuluslib. Then your cumulus.exe will be in cumulus_root_folder/cumulusserver/debug
I am open to either a Visual Studio answer or a MinGW answer. I just finished building LLVM 3.2 using CMake and Visual Studio 2010. Everything went smoothly, but I have no llvm-config. Do I need it? Every example I see on the intertubes makes use of that tool. If I don't need it, how do I configure my project to make use of LLVM?
To be clear, I am not trying to use LLVM tools/compilers (like clang and whatnot). I am trying to write C++ code that uses the LLVM libraries to produce LLVM IR and even compile that stuff. I setup my include and lib folders. I ran llvm-config in Linux and saw a long list of macros and libraries.
I have a wonderful folder full of goodies. It just has no llvm-config in there: C:\Program Files (x86)\LLVM\
llvm-config does not exist in windows prebuilt binaries. You need to compile from the source code to get it.
Grab CMAKE > 3.5 , install it and make sure you add it to PATH.
Download Visual Studio 2019
Donwload the source code (9.0.1 is the latest as I'm writing this)
Extract the source code
Cd into the root of the llvm source-code
In cmd, type cmake . this will generate Visual Studio 2019 sln.
open sln file(LLVM.sln), change the build type to Rlease, build the whole project
navigate to your Rlease\bin, and there you have your llvm-config.exe
If you have built the LLVM in debug version all the executables (including llvm-config) have been placed in your build directory (containing Visual Studio project and solution files) in bin/Debug/ subdirectory. In case of release build replace Debug with Release.
If you are interested in using LLVM on Windows more than building it, check out Windows snapshot builds.
I have a C project needed to be compiled into a DLL.
This C project includes . I had compiled a libcurl.dll from source with VS2008.
I put the libcurl.dll in C:\Windows\System32 (I suppose this serves as installing the DLL)
Now, when I compile my own C project, it says 'cannot open include file curl/curl.h'.
Did I miss any steps? Sorry I'm really new to Windows system.
Thanks in advance!
You need to add the path to curl/curl.h as an additional include directory in your project settings. Right click on the project, go to properties, and it's under the compiler section.
You'll also need to add curl.lib as a input library under your linker settings.