Add OpenSSL static libraries to a vc++ project - c++

I have some problems adding the OpenSSL libraries to my visual vc++ project.
I tried everything I could find but I am still unable to include any .h files in my code.
I have a directory where I put my .lib (libeay32.lib and ssleay32.lib) libraries in a sub directory of my project called "Lib". I also have a environment variable pointing to my OpenSSL installation folder called "OPENSSL". Here's some screenshots of my project's config:
Still with all that if I write #include "rsa.h for example, Visual Studio tells me it doesn't exist. What did I miss?

Have you tried including like this:
#include <openssl/rsa.h>
or
#include <rsa.h>
Which proper way of including is the first one, unless you've added inside of openssl folder in your include path

Related

How to use jsoncpp with Visual Studio 2022

I need my project to be able to use json format.
I was suggested this github : https://github.com/open-source-parsers/jsoncpp
I have been trying to integrate it to my project for multiple hours and still cant find the issue.
I still get these errors on my include :
#include <jsoncpp/json/json.h>
E1696 cannot open source file "jsoncpp/json/json.h"
C1083 Cannot open include file: 'jsoncpp/json/json.h'
I tried to go to C/C++ General->Additional Include Directories>
to add the "jsoncpp-master\include" directory
also tried "jsoncpp-master\include\json" directory
also tried to add the .h and .cpp found in the repository directly.
I have also tried a multitude of other things but I'm not sure it would be relevant to list them all here.
I was not able to find instructions to use it with Visual Studio 2022 on their github either.
Safest and most convenient way to use third party libraries is to use package manager like vcpkg
https://vcpkg.io/en/index.html
https://github.com/microsoft/vcpkg
Choose what build you want x86 or x64 and set default triplet in your environment variables
VCPKG_DEFAULT_TRIPLET
x64-windows - DLL Build 64-bit windows
x86-windows - DLL Build 32-bit windows
x64-windows-static - Static Build 64-bit windows
x86-windows-static - Static Build 32-bit windows
If you have added jsoncpp-master\include to C/C++ General->Additional Include Directories then you should use #include <json/json.h> instead of #include <jsoncpp/json/json.h>
Explanation : The compiler is looking inside the include directory. If you observer the file structure you can see json folder is located in the include directory and not jsoncpp.

how to link Qt with a visual studio c++ application project?

I have Qt 5.12.0 in a folder.
I need to create a dll and/or a bin project that can connect with a QML program.
My problem is that the vs project can't find the Qt files I need.
#include <QGuiApplication>
does not work.
This topic is the continuity of this one
How to link libraries to a project on visual studio? where I shared my problems with linking my dll with my bin project and to link Qt.
So I use a batch file to set the environment variable before launching visual studio. I use these variables to get the path to the Qt include folder, Qt lib etc.
Here is what I tried.
include the directory that contains the headers I need (I guess) :
configuration properties -> C/C++ -> General -> other include directories ->$(QT_INC)/. QT_INC is the path to the include folder. I also tried to write $(QT_INC)/* and $(QT_INC)/QtGui/. In any case,
#include <QGuiApplication>
couldn't compile.
i also added the path to the library folder :
linker->General->Additional library directories->$(QT_LIB)/
and some lib files in :
linker->entry->additionnal dependencies->Qt5Quick.lib;Qt5Gui;lib;Qt5Core.lib
none of these steps creates any error. It just doesn't help to find QGuiApplication.h nor QObject or anything I need.
I know my paths are correct and that using the environment variable like this works as I linked my dll using this method, and because wrong paths generates errors.
How to add Qt to my solution or to a project ?
thanks in advance
It works. The path was incorrect. There were "/" instead of "\" I think. And a synthax error in the batch file.
It's possible to add the header files of Qt by including the path in the properties.
include just the directory include of the Qt folder. Then, include headers again and again until all the errors are gone.
only for QGuiApplication, I need to include this
#include <QtGui/qtguiglobal.h>
#include <QtGui/qcoreapplication.h>
etc. all the includes of the beggining of QGuiApplication.h actually
here is the link to my other post I made about linking Qt to visual studio. How to link libraries to a project on visual studio? The problem was about the path to the dll.

Include 3rd party library in Eclipse CDT with Visual Studio Toolchain

I'm pretty new to using 3rd party libraries and such, and I need some help getting Eclipse CDT configured to link to the dynamic SDL2.dll library and be able to read the code from the header files in this 3rd party library. A lot of examples seem to be of linux system set-ups using GCC and such, but I'm trying to get it to work with the Visual Studio toolchain already installed on my PC.
Path to header files: C:\SDL2-2.0.5\include
Path to .dll and .lib files: C:\SDL2-2.0.5\lib\x64
Code:
#include "C:\SDL2-2.0.5\include\SDL.h"
int main() {
SDL_SetMainReady();
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)!=0){
SDL_Log("Unable to initialize SDL: %s",SDL_GetError());
return 1;
}
return 0;
}
I've tried adding the include path to the header files under Project>Properties>C/C++ General>Paths and Symbols>Includes>GNU C++(and GNU C), and I've tried adding the library path to "SDL2.dll" under Project>Properties>C/C++ General>Paths and Symbols>Libraries. The IDE still said it was unable to resolve the function calls; despite there being no issue with the #include "C:\SDL2-2.0.5\include\SDL.h" line.
I also tried adding the library path under Project>Properties>C/C++ Build>Settings>Tool Settings>Linker(link)>Libraries. Under "Additional libpath" i put: "C:\SDL2-2.0.5\lib\x64" and under "Libraries" I put: "C:\SDL2-2.0.5\lib\x64\SDL2.dll"; still with no success.
I even tried adding the include path to the .h files in the INCLUDE environment variable and the path to the .dll file in the PATH envirnment variable under Project>Properties>C/C++ Build>Environment.
Any help would be greatly appreciated.
On Windows, dynamic libraries have two parts: the .dll that contains the executable code and is needed at runtime and a .lib which is the import library that tells the linker to find the externals in the .dll. So, under "Libraries" you need to specify the import library (.lib). And put the .dll somewhere the executable can find it at runtime, e.g. in the same folder.

Unable to include files in Visual Studio 2013

Recently I have been trying to setup SDL2, but I have come across an issue.
I have added the directory to the include folder into my project's Include Directories, added the directory to the lib folder to my project's Library Directories and added the .lib files to my project's Additional Dependencies. The issue is though that whenever I try to do something like #include <SDL.h>, it gives off a "cannot open source file" error.
Though if I do a #include <iostream> or something, it will work.
Any help? Thanks in advance.
Have you tried #include "SDL.h"?

Cannot open source file in visual studio 2015

I am trying to compile OBS studio with this tutorial in windows using Visual Studio Community 2015. I have created a project in visual studio and copied the entire git repo into the project by dragging the files into the solution explorer. This project has dependencies on libav, x264, and curl. They are given as .lib, .dll, and header files.
The problem is I keep getting "cannot open source file". I have the the header files in a separate folder from the dll's and lib's (dll and lib are in the same folder). Under the project settings->VC++ Directories I added the include directory, and also added the library directory. Then I added the lib's specifically under Linker->input->additional Dependencies. Then I added the directory that contains the .dll files to the environment variable PATH.
After all this, I still keep getting the same error, as well as a few other errors. Here is a screen shot of one source file that has the issue.
These are my settings.
For the path, I have tried with and without the trailing forward slash.
EDIT:
Use the C/C++ settings instead of VC++ settings for additional include directories.
What is probably holding you up is that those folder icons in the VS sidebar are not actually related to the file system. They are filters and don't change depending on the actual directory.
This is another explanation for Drop's suggestion -- check to see if the files are really where you think they are.
In my case I already added the include libraries but that was not enough. The error went away once I switched the configuration from x86 to x64 in Project Properties.