VS2017 Nuget pthread LNK1120 unresolved - c

I heard that Nuget builds project easier without any configuration.
So, I am trying to add pthreads in my project from Nuget
(Actually I am using windows 10 x64 Visual studio 2017, C language, and my friends use linux OS)
I just search pthreads in Nuget package, click "install" button
But, my project compiles well but fatal error LNK1120 called.
Is there any more configuration after install pthreads from nuget?
The reason why I ask this simple question in stackoverflow is that, there is no more steps in Microsoft official guides.

Is there any more configuration after install pthreads from nuget?
Using Nuget format to install pthread into C++ projects is quite simple and will not manually configure include Directories and additional Dependencies address any more.
But pthread nuget package in VS has a drawback that it does not fully inherit pthread class library. It lost a file called pthreadvc2.lib. You can try my following suggestions to configure it without any settings in project properties.
Solution
1) download pthread-w32-2-9-1-release.zip from this link.
2) unpack this file and then copy pthreadVC2.lib from the file(pthreads-w32-2-9-1-release\Pre-built.2\lib\x86 or x64) into
C:\Program Files (x86)\Microsoft Visual Studio\2017\xxxxx\VC\Tools\MSVC\xxxx.xx.xxxx\lib\x86 or x64.
Note that you should copy the related lib into the related folder, x86 pthreadVC2.lib into x86 folder, x64 pthreadVC2.lib into x64 folder.
3) then add this into your cpp file:
#pragma comment(lib,"pthreadVC2.lib")
Then it will work as expected without any errors.

Related

installing GSL library for C programming in windows

I want to install the GSL library (https://www.gnu.org/software/gsl/) in windows. I have downloaded the files but i do not know what to do apart from that in order to be able to use the functions of the library (apart from the #include <...> in my program.c file).
I am using visual studio code and i have installed mingw.
Thanks in advance
EDIT
I am adding more information about this issue. I am not the original poster, but I have the same problem.
I am trying to use the GSL and I work with Visual Studio Code on Windows 10.
I have already installed the basic packages to work with C/C++ in
Visual Studio Code. More precisely, if I am not wrong, VS Code is
using the compiler gcc.exe from mingw64 (last version). This was
installed using an 'extension' available at VS Code (https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).
I downloaded the last version of the GSL (2.7) and unzipped it.
I get stuck when I try to follow the installation instructions. When I
execute either .\configure or ./configure in the DOS command line,
I get an error of "unknown command" (even if I am placed in the same directory where the file is stored).
When I execute .\configure in PowerShell, I get a message asking me
which programme should be used to open this file.
And here is where I get lost. :/
I have discovered an alternate path, which is installing GSL from vcpkg (https://vcpkg.io/). This is suggested by VS Code, actually. This vcpkg seems to be a programme by Microsoft to make it easier to install third-party C/C++ packages in Windows.
The specifications to install vcpkg are (https://vcpkg.io/en/getting-started.html):
Windows 7 or newer
Git
Visual Studio 2015 Update 3 or newer
I can try this path, but first I would like to be sure there is no easier way (installing Visual Studio to not really use it seems a lot to me!).

Cannot install vtune amplifier command-line interface

I try to install vtune command line interface on a target machine following the instrument https://software.intel.com/en-us/vtune-amplifier-install-guide-windows-installing-command-line-collectors. But get the error popup like the screenshot below. Any idea of it?
Met the same error for installing CLI for VTune Amplifier 2019 Update 4.
After some digging with unpacking msi package and dependency walker discovered that msi custom action dll imports functions from amplxe_sampling_utils_3.9.dll. Also this file relies on MS Visual C++ 2013 runtime.
For me it helped taking this dll from the VTune full installation (by default it is located at
C:\Program Files (x86)\IntelSWTools\VTune Amplifier 2019\bin32\amplxe_sampling_utils_3.9.dll
and placing it somewhere under system %PATH% for the installation purposes. I have not found better place than C:\Windows\System32 on a 32-bit target.
After the successful installation this dll can be removed from System32 as it it also installed with command line interface into target directory.

import libssh library in Visual Studio 2017

I'm currently trying to include the libssh library on Visual Studio 2017.
I already downloaded libssh but I don't know exactly what am I supposed to do with cmake. Where should I include files in Visual studio?
What you downloaded is the source code of libssh. So before you can link it to any of your own projects, you need to build libssh first. This were cmake comes in. CMake is the build system used for libssh.
In the source tree, which you have downloaded, you will find a file named INSTALL. It contains descriptions about all the prerequisites and a how you can use cmake to build libssh yourself.
If you prefer it, you can alternatively download a prebuilt version of libssh from https://www.libssh.org/files/win32/0.5/. The downside is, this is a quite dated version.
You can use vcpkg to download C++ libraries like libshh through command prompt. In this way the required dll's will be automatically include in your project directory, once you include the related header file in your project and compile it. See https://www.libssh.org/get-it/.

How to statically link DLLs and LIBs in VC++ Windows Form Application?

I am able to build my Windows Forms (32 bit) project in VC++ 2008. When I build a setup and try to run it on another system, it gives the error
Application failed to start because its side-by-side configuration is
incorrect.
I searched a lot for a solution and then tried to install the exact version on VC++ 2008 redistributable x86. But the problem is still same.
I tried to change the properties of the project from Dynamic link to static link, but this generated the error
"/Mtd" and "/clr:pure" command line argument is incorrect.
I was thinking if there is any way to combine the DLLs and LIBs with the application itself?
Or is there any other way?

The program can't start because MSVCR80D.dll

I have made a dll in Microsoft Visual Studio 2005. Then i am trying to use it in other project on the other computer in CodeBlocks IDE. Project is built, but when it use functions from dll i got an error: "The program can't start because MSVCR80D.dll is missing from your computer. Try reinstall the program to fix this problem". How to build my dll without dependences on MSVCR80D.dll or build in this MSVCR80D.dll?
You're trying to run a debug version, which is linked to the debug version of the CRT. The latter is only available where VS has been installed. You should use the release version of your project on other machines (or manually copy all the dependent debug DLLs, which is not legal according to the license...).

Resources