I'm getting into OpenGL and Visual Studio, and just got this warning and couldn't find any possible solution. I've added both GLEW and GLFW Libraries to the include directory, and then again in the input section of the Linker menu, in the project's properties. Anyways, Visual Studio seems unable to find any of them.
See these images - they explain it all.
Include Directories:
Linker Input:
The Problem:
GLEW Directory:
GLFW Directory:
All image link together
It's because your include directories should be pointing to where the header files are, not the .lib files.
Change your include directory to go to where the .h files are located, for me it's C:\...\glew-2.0.0\include\GL
The directories you currently have in it should instead go into Additional Library Directories located at linker->general in your options
Related
I'm trying to add the Boost C++ Libraries to my C++ project created with Visual Studio 2017.
I have followed the instructions here.
When that didn't work I tried the advice in this post. Neither solutions worked for me.
What I have done:
Downloaded boost_1_69_0-msvc-14.1-64.exe from this precompiled boost libraries page
Installed to D:\local\boost_1_69_0
In my project I added D:\local\boost_1_69_0 to Properties > VC++ Directories > Include Directories and added D:\local\boost_1_69_0\lib64-msvc-14.1 to Properties > VC++ Directories > Library Directories
I have my project set to x64 and the above settings were set in the x64 configuration
When I try to build my project I get this error:
Error C1083 Cannot open include file: 'boost/regex.hpp': No such file or directory
Which points to this line of code in one of my .cpp files:
#include <boost/regex.hpp>
Please go to D:\local\boost_1_69_0 folder and see if you have a sub-folder named include in there. If you do, then instead of D:\local\boost_1_69_0 you need to set D:\local\boost_1_69_0\include in Properties > VC++ Directories > Include Directories
In other words, try to find the file you are including on your hard drive. Look at the full path to the file. Compare that full path with the path you added to the list of include directories (Properties > VC++ Directories > Include Directories) concatenated with the relative path you provided just before the filename in your include directive (boost). See if the two are the same.
If that does not help, then make sure you changed list of include directories for the same build configuration as you are attempting to build (if you build Debug, make sure you changed configuration for Debug too). Since VS 2015 IDE stopped making sure the two are selected in sync, which is annoying.
If your files are copied, then you have to compile the regular library.... If the same version of the compiler copies the machine.
Found out it was failing because I had included the same .cpp file which has the boost include into my unit test project which did NOT have the Include/Library folders set. The settings in my original question work now.
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.
I am using Visual Studio 2013 and have troubles using libusb dll. I have downloaded their source and compiled the dll version under release. New folder was created: D:\libusb-1.0.9\Win32\Release\dll which contains the .lib and .dll files. The next thing I did, was copied the .dll to my Visual studio projects folder, where the source files reside.
In Visual studio I then did: project->properties->linker->input->additional dependencies and pasted in the path to .lib file: D:\libusb-1.0.9\Win32\Release\dll\libusb-1.0.lib. Then I did project->properties->linker->general->additional library directories and pasted in the folder where the libusb header files are: D:\libusb-1.0.9\libusb.
Then I tried including the #include "libusb.h" but it says it cant find the file.
What else do I need to do, to make it work...?
EDIT:
These are the exact errors:
Cannot open include file: 'libusb.h': No such file or directory
IntelliSense: cannot open source file "libusb.h"
The problem is you did not add the folder containing the header file libusb.h to the include folders for your compiler. As a result the compiler can not find libusb.h since it is not in any of the folders the compiler searches.
In Visual Studio to add a folder to the include directories open the project properties for your target and add the folder to the C/C++->General->Additional Include Directories setting.
I have a cmake project that needs to link to a library that contains some .lib files and a .obj file. I've found some clues to how to link to a .obj file, but most solutions seem very complex.
All I really want to do is tell cmake to add the .obj file to the linker input in my Visual Studio project.
I tried linking it as I am doing with normal lib files:
target_link_libraries(Foo C:/a.lib C:/b.lib C:/c.obj)
However when I check the linker input in the generated VS project, cmake has removed the full-path and appended .lib to the obj file:
C:/a.lib
C:/b.lib
c.obj.lib
What's the simplest way of getting this result:
C:/a.lib
C:/b.lib
C:/c.obj
Note that this only needs to work with Windows and Visual Studio.
I was facing facing the same issue when I found your question. It is solved by the following line:
SET_TARGET_PROPERTIES(my_project PROPERTIES LINK_FLAGS "/link setargv.obj")
The link is appended to Additional Options in the Command Line Section from project's linker settings.
Is it possible to build and link Glew and GLFW without copying files to the C:??
I can't find any documentation that shows how to use these libraries without copying DLLs to the Visual Studio Directory on the C:.
I just want to include all the .dll and .lib files needed in the directory of my project.
You don't have to put the DLLs in Visual Studio Directory .You can drop those in the Debug or Release (based on your compile mode) folder of your VS project.And you do have to include those DLLs.The rest of setup is rather simple.Right click your project and select "Properties".Include the headers of both libs under C/C++ --> "Additonal Include Directories" . Then : Linker --> "Additional Library Directories" you include the folders containing the lib files.And lastly under Linker-->Input-->"Additional Dependencies" add the names of glew and GLFW libs (glew32.lib , GLFW.lib)And you are ready to go.