Using pthread in c++ on Visual Studio 2013 - c++

I am trying to use the pthread library on windows. I downloaded a zip with a Pre-built.2 folder in it and followed the instruction.
What I have done so far:
all .h files from POSIX\Pre-built.2\includeinto MS VS2013\VC\include folder
all .dll files from \dll\x86dll\x86 into VC\bin
all .lib files from lib\x86 into VC\lib
In Property->Config->Linker->Input->Additional Dependencies, pthreadVC2.lib;pthreadVCE2.lib;pthreadVSE2.lib;%(AdditionalDependencies) // pthread.lib already in Inherited values
I included pthread.h inside my program and when trying to build solution, the following error appears:
Error 1 error LNK1104: cannot open file 'pthread.lib'
Can anyone help me out? Thanks.
EDIT:
The Include Directories and Library Directories are
A:\Program Files %28x86%29\Microsoft Visual Studio 12.0\VC\include;$(IncludePath)
and
A:\Program Files %28x86%29\Microsoft Visual Studio 12.0\VC\lib;$(LibraryPath)
respectively now. But I still get the same error message.

Add the folder containing the LIBs to Configuration Properties -> VC++ Directories -> Library Directories.

Related

Boost Library cannot get to work in C++, Include directories not working

I recently tried to install boost libraries in C++ 14, and I added it's include paths like:
Solution Explorer > Project Name > Property Pages > VC++ Directories > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost"
I tried to compile after adding this:
#include <boost\variant.hpp>
In Error List window, I can see E1696 - cannot open source file "boost\variant.hpp" and I can't compile like before.
Then I tried with adding a backslash like "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost\", still didn't work.
I also read this post and explicitly specified it's directory, but even didn't work.
Again, I read this post and did exactly same what is in given answer (as I already built project several times) , but still no success.
However, if I include a library like:
#include "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost\variant.hpp"
Now compiler recognizes it, but now I can see more than 100 errors in Error List window, those errors are pointed to header files of boost libraries, not in my project file which has variant.hpp included.
All those errors are E1696 - cannot open source file "boost\<libraryname.hpp>" or E1696 - cannot open source file "boost\<subdirs>\<some other files included in libraryname.hpp>"
So, if I remove the line #include "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost\variant.hpp" from my project's header file, all errors disappear suddenly and project compiles fine! no any single error now!
I want boost to work anyway, so I can use it in projects, but I can't manually edit all those header files and change <boost\... to original locations.
Please help me to get rid of this issue.
make sure you download and install the correct boost version. Installing it in the visual studio directories is possible, but not advised. I suggest you use one of the packages from here. Assuming you use visual studio 2017 and you are developing for 64bit, this could perhaps be the correct package for you.
make sure you do both: adding the include search path and the library search path to your visual studio.
The include search path should point to the boost-installation root directory (the one that contains the Jamroot file and a boost subdirectory). The library search path should point to the correct library subfolder within the boost installation. This is one of the subfolders that start with lib64-msvc-**.* (or lib32-msvc-* if you're developing for 32bit).
The default install path of the binary boost package above will install it into C:\local\boost_<boost version>. Make sure you use the paths from this installation directory and follow the instructions here.
Example:
Include search path: C:\local\boost_1_64_0
Library search path: C:\local\boost_1_64_0\lib64-msvc-14.1

Cannot open include file "windows.h" No such file or directory

I am trying to build a project which contain several C# projects and one C++ project in VS 2013.
But during build the above error is shown, then i googled the error and tried several things but unable to fix the issue.
Things i have tried:
1) Added Window 10 SDK's Include directory to the Additional Include Directories
in C/C++ Configuration properties.
2) Added Window 10 SDK's Lib directory to the Additional Library Directories into the Linker.
3) Making sure that include file is "windows.h" instead of "Windows.h".
Path of Windows.h file present locally in SDK directory is
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um
Does any have any idea how can i fix this ?
Any help will be appreciable.
Go to the project properties -> Configuration Properties -> General
then Change Platform Toolset to Visual Studio 2013- Windows XP(v120_xp).
This is what worked for me.

cannot open file 'libboost_log-vc120-mt-1_58.lib' in VS 2013 C++ project

I am attempting to compile a project in visual studio 2013 that is using boost 1.58.
I am receiving this error:
Error 3 error LNK1104: cannot open file 'libboost_log-vc120-mt-1_58.lib'
This entry is in my VC++/General/Library Directories
$(BOOSTDIR)\lib\x64
the value of my BOOSTDIR directory is
C:\Projects\boost_1_58_0
I have verified that the path C:\Projects\boost_1_58_0\lib\x64 has the "libboost_log-vc120-mt-1_58.lib" file.
What could I be missing?
I resolved the issue by rebuilding boost and then adding the new lib location as follows:
Add $(BOOSTDIR)\libs;$(BOOSTDIR)\stage\lib; to Additional Libraries
Add $(BOOSTDIR) to Additional Include Directories
I'm guessing there was a compiler mis-match between my project and whatever boost was built with (even though my coworker told me it was built using the same compiler). Or it could have been the path was wrong or missing.

How to link to a library

Visual Studio 2010.
My library is in a folder called "lib" which is in the project folder.
I had added the library to Properties>Linker>Input>Additional Directories, and have tried various things in Properties>Linker>General>Additional Library Directories but none work (have tried ../lib, $(SolutionDir)../lib, lib, and same with an additional slash at the end).
I also tried just having it in the project folder which didn't work either. (With $(SolutionDir) in Additional Library Directories or blank)
I always get this linker error: LINK : fatal error LNK1104: cannot open file 'cyclone_d.lib' or LINK : fatal error LNK1104: cannot open file 'cyclone.lib' if trying to build a release version.
If anybody has any ideas about what I need to do that would be fantastic.

Linker library error in visual studio

Running visual studio 2010 writing an openGL program in C++
I'm getting this error, and can't for the life of me figure out why
fatal error LNK1104: cannot open file 'Image_Loading/nvImage.lib'
The file is in the correct place, and nvImage.lib is present in the additional dependencies of the linker, any ideas??
The folder "Image_Loading" is probably not in your library search path. Include files has a different search path, so even if its find the includes, the folder might be missing from the libary search path.
you should either add the folder to the LIB enviromental variable, or add /LIBPATH:folder to the command line of the linker.