Can't compile project because of wininet library - c++

I cloned a project from github to my computer and I'm trying to compile it but I'm getting a crazy amount of errors regarding references to libraries and stuff. I uploaded the project from another computer and it works just fine in that computer. Here are the errors I'm getting:
There are more errors but these are enough. As you can see the issue is within the included libraries (which are static), so I'm not sure what I'm missing here, because the linking to the wininet library and such are fine.
Maybe its an inconsistency between x86 and x64? I dunno.
The path to the c++ compiler:
C:\Program Files
(x86)\mingw-w64\i686-5.2.0-win32-dwarf-rt_v4-rev0\mingw32\bin\c++.exe
Path to library
C:\Program Files
(x86)\mingw-w64\i686-5.2.0-win32-dwarf-rt_v4-rev0\mingw32\include\wininet.h
I followed these steps to configure this environment:
-Downloaded netbeans
-Downloaded mingwin
-Downloaded msys
Its weird because when ctrl + click the wininet.h and variable types and everything it directs me to where they're declared, however the environment can't locate them.
If you need more information please tell me.
Thanks!

There's no such thing as "the WinInet" library that you can download. This is all part of the Windows SDK. LPVOID for instance is defined after you include <windows.h>

Related

Missing libgcc_s_seh-1.dll starting the .exe on Windows

Intro
I have a CMake-based C++ project. Until now I build and ran the project via CLion. Everything worked fine until I tried to run the .exe-file directly (not via CLion).
Problem
When I navigate to the cmake build directory in order to start my program via the executable file, it fails with the following message in the popup: Cannot continue the code execution because libgcc_s so-1.dll was not found. Reinstalling the program may resolve the issue.
I have the following questions
If I interpret the error message correctly, then this dll is missing on my computer. So I ask myself, why does my program still work when I start it via the development environment (CLion), although the error message expressly states that the source code requires this dll?
Is it the fault of my application/source code that the error appears or rather the current state of my computer? If the former, how can I prevent this error from appearing for other users?
What is the best way to fix this error? It's obvious that I need to download this dll, but where is the best place to put it (which directory and environment variable to use on Window)?
Which source is trustworthy to download this dll? I don't want to download any malware under this dll-name.
Optional: What kind of library is that? What functionalities does it offer?
Additional information
I use CMake as my build tool, CLion as the IDE and MinGW as the compiler.
What I have did so far?
I made sure it still works through the IDE.
I found this dll does not exist in the MinGW installation folder.
I searched the web for more information. Unfortunately, there are only pages unknown to me that only offer the download of this dll. That doesn't satisfy me.
I found the cause of my problem: I had two MingGW installations on my machine. Once the installation that comes with CLion and a separate one. The latter did not have the required dll. However, CLion used its own installation, which in turn owns the DLL. So the solution was to remove the separate installation and include the path to the CLion installation's bin/ directory in the PATH environment variable.
This file is part of MinGW-w64 when using SEH as exception model (as opposed to Dwarf or SJLJ). You need to distribute the .dll files your .exe file(s) depend on in the same folder as the .exe file(s).
If you don't have that file, then you probably have been using libraries compiled with different versions of GCC/MinGW(-w64). I recommend building everything with the same compiler to ensure stable binaries.
Tools like Dependency Walker can help you figure out which .dll files your .exe file depends on.
Or use the command line tool copypedeps -r from https://github.com/brechtsanders/pedeps to copy the .exe files along with it's dependencies.

Building protobuf for Linux using VS2017

I have configured VS2017 to build Linux C++ by remote building on a Linux Mint VM.
I tried a simple C++ program and it compiles and executes fine, the thing is that now I need to add a generated protobuf source and the linking fails constantly.
On the Linux VM the protobuf generated files are building correctly and I was able to execute the gRPC examples.
The errors I get when I build from VS2017 are a lot of:
undefined reference to 'google::protobuf::internal'
and there is also this one
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Application Type\Linux\1.0\Linux.targets(262,5): error : Illegal characters in path.
I think this is a VS2017 remote compilation configuration issue, but I don't know what could it be.
Has it happened to you? Do you know how to solve this issue?
Thanks
SOLUTION: I the project properties go to Linker > All Options > Library dependencies and add: protobuf;pthread;grpc++;grpc
This explains the "Illegal characters in path" message.
Does protobuf link to any libraries on the Linux system? Assuming you're not using CMake, have you added the libraries andtheir path(s) to the Visual Studio project - Library Dependencies and Additional Library Directories.
This might help with specifying libraries.

How can I make my application find a third-party DLL using Visual Studio?

I have read many issues regarding and followed each one but nothing seems to work.
I am trying to include the rdkafka library into my project, but every time I run the application I am getting
The program can't start because librdkafka.dll is missing from your computer.
I can clearly see that librdkafka.dll as well as librdkafka.lib exist in the same directory. I have added the include files to the project, and I have also added the librdkafka.lib to the additional directories in the Linker section. The project builds fine but it throws that error at runtime.
Does anyone know how I can solve this issue?
When in Visual Studio by default it is searching for dlls in the project directory and running the application on its own will try to find the dlls in the current working directory. Moving the dlls to this location seems to solve the issue.

Linking libpqxx from Visual Studio 2015 on Windows 10

I've recently decided to try out PostgreSQL as the database platform for some C++ development I'm working on. I decided to use libpqxx as the connection library for my project, and quickly found out this would be an uphill battle to do from VS 2015 on a Windows 10 machine.
After much teeth-gnashing and nail-biting, I have gotten libpqxx to compile on Windows 10.
This leaves me with the following directory structure
Per libpqxx's documentation, I also placed a copy of libpq.dll in my project's executable directory. Please note: I have done this for both debug and release builds, tried to build both, and ended up with the same result.
All the tutorials I've seen seem to indicate that the library can be used after linking it and simply #including pqxx/pqxx, so I set up a small project to do just that. I receive the error:
fatal error C1083: Cannot open include file: 'pqxx/pqxx': No such file or directory
When attempting to build the project. I have also tried this will both debug and release builds, to no avail.
Here is a screenshot of my linker settings.
Does anyone have any suggestions for how I might be able to link and use this library from Visual Studio 2015?
As Sami Kuhmonen pointed out, this was not actually a linker error, but a compiler error. I needed to include an actual header, which Visual Studio needed to be able to find. After adding the correct folder (C:\libpqxx\include in my case) to Visual Studio's "additional include directories" setting under C\C++ -> General per drescherjm's suggestion, the program compiles just fine.
For future reference:
I did also run into unresolved external linker errors after solving the initial issue. This is because you need to make sure to also link to ws2_32.lib and libpq.lib. You also need to copy some other DLL files that libpq also relies on into your libpqxx lib folder. On my system, I believe these were ssleay32.dll, libeay32.dll, and libintl-8.dll. These files reside under the root of the PostgreSQL install. The DLL step is mentioned under libpqxx's INSTALL.txt file, however I believe it stated that the DLLs resided one folder under where I actually found them.
I have also faced same issue. Then I realized that I was building ,my application as a 32bit. I changed the target to x64 and it compiled successfully

Packaging libraries with .exe

I've made an application using both the OpenCV and WxWidgets library. The code runs fine on my development machine.
However, when I transfer it to another windows machine I get the error
*"The program can't start because cv110.dll is missing from your computer.
Try reinstalling the program to fix this problem".*
Now, I'm guessing installing the same versions of OpenCV and WxWidgets as used in development would resolve this problem but this is a bit much to ask of a casual 3rd party user of my code.
In my IDE (Windows Visual C++ 2008) I've linked to the relevant .lib files by going to Properties->Linker->Input
How would I go about packaging the .exe so that it works on non-development machines?
i.e. if I include the .dll files, how would I need to change the linker configuration to reflect this ? Or, can the .dll files referenced by the .lib files be incorporated into the .exe ?
Sorry, I know this issue has come up before but I can't seem to find a resolution specific to my case. Any help would be appreciated!
OpenCV is built using dynamic libraries
The correct thing to do is create an installer containing your exe and the correct dlls you need. See https://stackoverflow.com/questions/1285591/installer-recommendation