Sarp Kaya
Sarp Kaya

Reputation: 3784

Using other libraries in Visual C++ 2012

Hello I want to use pthreads in Visual C++, VS2012. I downloaded the release file but I don't know how to include and load it for VS2012, as it gives such error IntelliSense: cannot open source file "pthread.h"

Upvotes: 0

Views: 4454

Answers (3)

Jon Weir
Jon Weir

Reputation: 1

There is a difference between "Additional Include Directories" and "VC++ Directories":

  1. Additional Include Directories is encapsulated within the Project File. So making changes here does not break or modify the compilation or linking of any other project you work on.

  2. VC++ Directories is shared by all projects you build with that compiler. You can easily break other projects by modifying what you find here.

To avoid breaking (sometimes in very subtle and confusing ways) unrelated projects, it is preferable to encapsulate your directory settings within a particular project by setting Additional Include Directories (and equivalent for libs).

Upvotes: 0

Luchian Grigore
Luchian Grigore

Reputation: 258598

Right click on project -> properties -> C/C++ -> General -> Additional include directories.

Add the directory there.

For the libraries, go to Linker -> General and add the directory with the libs, then go to Linker -> Input and add the libraries themselves.

Also, note that IntelliSense isn't a compiler, so that might even be a false positive error.

Upvotes: 1

Gustavo Litovsky
Gustavo Litovsky

Reputation: 2487

Right click on the project and select the property pages. Then add path to the includes and the library to VC++ Directories. In the linker section, add the lib file name itself (likely pthreads.lib).

Upvotes: 0

Related Questions