Glew+GLFW Win32 No Dependencies Visual Studio - c++

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.

Related

vs 2017 static library "No Such File or Directory"

I'm having problems importing my custom static library into my project. I have my library in the same solution as the project that I am trying to include it in.
In the VC++ Directory section of the project properties I have put "$(SolutionDir);" in the Include Directories and "$(SolutionDir)Debug\;" in the Library Directories. It is my understanding that the "$(SolutionDir);" is a macro that defines the root directory right? As the library shares the same solution as the project it also shares the same root directory and the .lib file that is created is in the Debug folder of the root directory.
In the Linker/Input section, I have put "GameEngine.lib;" in the Additional Dependencies. "GameEngine.lib" is the file name of the .lib that is in the Debug folder of the root directory.
When I'm trying to include anything from the library it just doesn't even recognise it as existing when writing:
#include <GameEngine/Rendering/Model.h>
Doing it the way below shows that it can actually find the file, meaning the path exists and is correct but I get linker errors doing it this way.
#include "../GameEngine/Rendering/Model.h"
I am using Visual Studios 2017.
Link to GitHub repo: https://github.com/TheHoester/OpenGLGameEngine.git
Thank you
You need to make sure you set the directories for all build configurations. You have only set the include directories for the "x64" platform so building the "Win32" platform won't work. After adding the directories to the "Win32" platform your project builds correctly.
Note that it is more usual to use "VC++ Directories" for system includes and libraries and to use "C/C++/General/Additional Include Directories" and "C/C++/Linker/General/Additional Library Directories" for linking to your own libraries. There isn't any problem that I'm aware of for using the "VC++ Directories" settings though, just make sure not to modify any of the existing paths in there.

How to add Qt libraries to visual studio

I have a source with VC++ 2017
I receive the error "Error C1083 Cannot open include file: 'QtCore/QMap': No such file or directory " when i try compile the project.
I download Qt libraries and add to Include project but the problem exist.
Which directory of Qt of i had to add to project to resolve error?
this is header of my code that generate error
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QList>
You need to update your project. Go to the project properties by right-clicking on it in Solution Explorer and then select Properties. Then:
In C/C++->General->Additional Include Directories you must set the Qt installation include path;
In Linker->General->Additional Library Directories you must add the path of .libs files of your qt installation;
In Linker->Input->Additional Dependencies you must put the name of .lib files that you need in order to build the project.
If it's a Qt project, you should also have the Qt plugin installed, in order to work properly with moc and other Qt features.
In alternative (that I suggest) you can create a CMake project and open in in Visual Studio.

Cannot open source file "GL/glew.h"

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

Is it a Must to use both pthreadVC2.lib and pthreadVC2.dll in visual studio 2013?

I download pthread-w32-2-9-1-release.zip, unzip it and use Prebuild/include lib and dll with VisualStudio2013.
I set up a VC++ empty project "helloc" with main.c, then write a simple example with pthread_create pthread_join functions.
This is my configure:
Properties->C/C++->General->Additional Include Directories, add "F:\pthread_win32\include"
Properties->Linker->General->Additional Library Directories, add "F:\pthread_win32\lib\x86"
Properties->Linker->Input->Additional Dependencies, add "pthreadVC2.lib"
And it's successfully build, but when I click "Local Windows Debugger", the console break with "helloc.exe error because cannot find pthreadVC2.dll".
Then I copied pthreadVC2.dll to helloc/Debug/, same directory with helloc.exe, finally it's working.
But I don't know why the pthreadVC2.lib and pthreadVC2.dll are both required by helloc.exe. Is it a must that both lib and dll being used in VisualStudio ?
If only one of them (pthreadVC2.lib pthreadVC2.dll) is enough to support helloc.exe, how can I specify which one (dll or lib) I want to use in VisualStudio with helloc.exe ?
And I don't want to put all pthread libs and dlls into "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC", I want to know how to configure manually.
AFAICT, the pre-built library is just an import library for the DLL. (Allowing you to link against the DLL, hence required)
If you want to link statically, you'll have to rebuild the library yourself. See the README file for more information.

Adding openCV .dll files to Netbeans C++ Qt application

I am developing software where I need to use the OpenCV libraries under NetBeans. Took 2 days to be able to run correctly a C++ Application with OpenCV.
In a C++ Application I needed to add C:/OpenCV245/build/include in project properties->Build->C++ compiler-> Include Directories and Headers. Also, Under the Linker properties-> Additional Library Directories I had to add the following directories
C:/OpenCV245/release/lib
C:/OpenCV245/build/x64/mingw/lib
and add the .dll files I specifically needed in the linker->libraries
Now when I try to create a C++ Qt application, I add the proper include directories and headers but I can't add the path to my "additional libraries"...
I tried building to see what errors would pop:
cannot find -lopencv_core245.dll
cannot find -lopencv_highgui245.dll
How do we add .dll.a files to a C++ Qt application under Netbeans?
Programming environment:
NetBeans 7.4
MinGW 3.2 Compiler c++ compiler, msys make command and qt5.1.1 qmake for Qmake Command
Qt5.1.1
OpenCV2.4.5
Windows 8 64 bit
It appears as if you are trying to link with the *.DLL files instead of *.LIB files. The right way to go is to:
In the linker->libraries settings link to the *.LIB files you need instead of the *.DLL files.
Compile your program so you get an *.EXE
Put the relevant *.DLL-files in the same folder as the *.EXE
The program is now runnable if you double-click its icon in the file browser.
It the program refuses to run from Netbeans but it works from the file browser, then that is because you need to tell Netbeans what the "current working directory" is when you launch the program in debug mode. This setting should be available in some settings dialog.
+Under Project Properties-> Build -> Qt go to Expert Custom Definitions add add the path to the appropriate .dll.a files with the LIBS +=
+Under Project Properties-> Build -> C++ Compiler in Include Directories and Headers add the appropriate path for the includes. ex: C:\OpenCV\build\include
+Under Project Properties-> Build -> Linker click on Libraries then Add Library File... ( NOT ADD LIBRARY) and add the appropriate .dll.a files that were included in the first point.