How to set dependency DLL paths in Visual Studio? - c++

I am working with Cyclone DDS, and they have two builds,
c build (contains multiple files in the bin folder)
and c++ build (contains DLL file in the bin)
after Cyclones DDS installation, I have to set these bin paths in system environment variables.
how can I avoid this? I need to set them in the visual studio 2017 itself. without setting paths in the system environment
or can I copy bin files into my project directory? so that I can use the project file on any PC which has visual studio 2017 without reinstalling CycloneDDS?

Windows by default will prefer .DLL files in the same directory as the .EXE. So while developing, you can put them in your Visual Studio Debug and Release folders. For other people, you include the DLL's in the installer.
The exception is the *140.dll stuff, for which you need the Visual C++ redistributable. That's installed as part of Visual Studio 2017, but can also be distributed independently (hence the name).

Related

"newly" installed visual studio returns 408 errors on blank program of type 'cannot open source file "errno.h" '

Having installed VS 2019 on my PC, and opening up a new project, i get 408 errors that all say it cannot open various source .h files, such as errno.h, float.h, corecrt.h, etc. or 'the global scope has no "acosf" 'I had just installed visual studio and have no clue how it works, and have not done anything other than install it and open up a new project.
Possibly useful information:
It was not installed in the default location, but on the D: drive
visual studio works fine when I open it with unity to edit scripts for my unity projects, but when opening it from its desktop icon or from the start menu, i get the errors
Unity was installed before i installed Visual studio and appears to be using a different version of visual studio somewhere else on my PC, but i cant find where it is, hence me installing it myself
The project is a C++ project
I have already tried repairing visual studio and reinstalling it, but it did not work.
I had the same issue (here), the problem is that for some reason, MSVS is not adding the Windows Universal CRT SDK to the include and library paths (this SDK has the header files for things like "float.h" and so on).
To add it to your project, you need to add the include and lib paths in the Project settings.
In my case they were:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt <- header path
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64 <- library path
(you can find it by searching for "float.h", and "ucrtd.lib", but be careful not to use the path for Linux headers).
You can add these paths at: Project Properties -> C/C++ -> General -> Additional Include Directories (add header path here)
and then Project Properties -> Linker -> General -> Additional Library directories (add library path here).
I suggest you could to check the version of Windows SDK in visual studio installer. And then set the appropriate version of windows sdk in the property -> General -> windows SDK version.

How to permanently install GLUT for visual studio 2015?

Is there anyway to permanently install GLUT for visual studio 2015? I tried searching for it and it has showed some steps to add the GLUT libs and dlls in the project. Well this way does work but as far as I've noticed I have to do all the steps all over again if I create a new project and do code in that which is definitely not efficient. So is there anyway to permanently include GLUT files in visual studio 2015?
Maybe you can create a property sheet in your vs, then fill out the libs, dlls and include path and save it, you can import it next time when you create a new project.
This might be a bit late but I'm going to share what worked for me.
Download the pre-compiled GLUT binaries from here and extract it anywhere you want
Find and cd into your VS 2015 path, for me it was C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
From extracted GLUT folder copy all *.lib files to lib folder on your path, all *.h files to your include folder and *.dll to bin folder
Now your Visual Studio 2015 project should recognize when you add GLUT includes.

Setting up Aquila for my c++ Project in Visual studio 2012

I want to use Aquila DSP to compute MFCC features in my project and trying to make it work.I followed this tutorial but after mingw32-make install on the source code pulled from Aquila's git repo, it generates only libAquila.a in lib folder. I tried changing my project's include and library dependencies using these generated files after install. Also tried adding FindAquila.cmake and tried building my project with cmake for VS 2012, still no luck. Keep getting "aquila/global.h" no such file or directory when I try to include "aquila/global.h".
I also tried building Aquila with cmake for VS 2012 and able to compile it and it generates .lib files as well, but not sure how to proceed with that.
If anyone knows how to make it work, it will be great help.
So, I made it work with Visual studio 2013. Now what I am doing is I am building Aquila with both Mingw and with VisualStudio. Mingw gives required include files and visual studio build gives required .lib files. I am building Aquila in VS 2013 with configuration type static lib (project properties >> General >> Configuration type) for both debug and release configuration and then I build the project.
For Mingw, first I use cmake GUI with mingw cmakefiles configuration and then run mingw32-make install in the build directory, which will put the include, lib and share files in the installation directory( usually C:\\Programme files\\Aquila.
Now I create a Folder Aquila and put include and share from above path and create a new folder lib with two subfolder debug and release. Here I put two .lib files in each folder (aquila.lib and Ooura_fft.lib) (debug libs in debug and release libs in release folder, they will be VS build folder). Once this is done, in my project setting, I add Additional include directories under C++ >> general, Addiotnal library path under linker >> general and names of libraries under linker >> input for both bebug and release configuration. After doing all these things, now the library works with my project.

qmake: how to remove the dependency of absolute paths?

Qt Creator + VC19 (MSVC2015) + WinSDK8.1
No Qt itself used. Just console application std+boost+catch+easyloggingpp
VC\bin and WinSDK\bin both are in a system path variable.
all includes and lib paths configured in a pro file.
I need to move them out from project file to build this project on various machines (all windows but different locations of the used libraries).
I think that cl.exe can read this from LIB and INCLUDE env variables, but if I do this (set headers and libraries paths from bat file or in a project settings in QT Creator) it doesn't work, QtC reports me that can't find some headers.
Could you clarify for me:
Should Qt Creator read LIB and INCLUDE variables for the build and parsing? What is right steps to make it working?
If Qt Creator can't read the env variables , then what is right way to remove the dependency of absolute paths in project build with qmake?
You obviously have Visual Studio compiler and other standard library paths hardcoded as absolute in your project file?
All the Visual Studio or other compiler settings e.g. tool chain location are normally read by Qt Creator from compiler kit. Adding Compilers article clarifies on that. That is the first thing to configure as long as your system has Visual Studio installed. Having configured compiler kit you will be able to add one to your current project build: Configuring Projects article.
And in case if you build from command line with qmake and jom: your build script may execute the Visual Studio standard environment batch script file like:
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\VcVarsAll.bat" amd64
Mind the target bitness (32/64) and actual location of your Visual Studio. There is MSDN article for that: Setting the Path and Environment Variables for Command-Line Builds.

How do you install GLUT and OpenGL in Visual Studio 2012?

I just installed Visual Studio 2012 today, and I was wondering how can you install GLUT and OpenGL on the platform?
OpenGL should be present already - it will probably be Freeglut / GLUT that is missing.
GLUT is very dated now and not actively supported - so you should certainly be using Freeglut instead. You won't have to change your code at all, and a few additional features become available.
You'll find pre-packaged sets of files from here:
http://freeglut.sourceforge.net/index.php#download
If you don't see the "lib" folder, it's because you didn't download the pre-packaged set.
"Martin Payne's Windows binaries" is posted at above link and works on Windows 8.1 with Visual Studio 2013 at the time of this writing.
When you download these you'll find that the Freeglut folder has three subfolders:
- bin folder: this contains the dll files for runtime
- include: the header files for compilation
- lib: contains library files for compilation/linking
Installation instructions usually suggest moving these files into the visual studio folder and the Windows system folder: It is best to avoid doing this as it makes your project less portable, and makes it much more difficult if you ever need to change which version of the library you are using (old projects might suddenly stop working, etc.)
Instead (apologies for any inconsistencies, I'm basing these instructions on VS2010)...
- put the freeglut folder somewhere else, e.g. C:\dev
- Open your project in Visual Studio
- Open project properties
- There should be a tab for VC++ Directories, here you should add the appropriate include and lib folders, e.g.: C:\dev\freeglut\include and C:\dev\freeglut\lib
- (Almost) Final step is to ensure that the opengl lib file is actually linked during compilation. Still in project properties, expand the linker menu, and open the input tab. For Additional Dependencies add opengl32.lib (you would assume that this would be linked automatically just by adding the include GL/gl.h to your project, but for some reason this doesn't seem to be the case)
At this stage your project should compile OK. To actually run it, you also need to copy the freeglut.dll files into your project folder
This is GLUT installation instruction. Not free glut
First download this 118 KB GLUT package from Here
Extract the downloaded ZIP file and make sure you find the following
glut.h
glut32.lib
glut32.dll
If you have a 32 bits operating system, place glut32.dll to C:\Windows\System32\, if your operating system is 64 bits, place it to 'C:\Windows\SysWOW64\' (to your system directory)
Place glut.h C:\Program Files\Microsoft Visual Studio 12\VC\include\GL\ (NOTE: 12 here refers to your VS version it may be 8 or 10)
If you do not find VC and following directories.. go on create it.
Place glut32.lib to C:\Program Files\Microsoft Visual Studio 12\VC\lib\
Now, open visual Studio and
Under Visual C++, select Empty Project(or your already existing project)
Go to Project -> Properties. Select 'All Configuration' from Configuration dropdown menu on top left corner
Select Linker -> Input
Now right click on "Additional Dependence" found on Right panel and click Edit
now type
opengl32.lib
glu32.lib
glut32.lib
(NOTE: Each .lib in new line)
That's it... You have successfully installed OpenGL.. Go on and run your program.
Same installation instructions aplies to freeglut files with the header files in the GL folder, lib in the lib folder, and dll in the System32 folder.
OpenGL is bundled with Visual Studio. You just need to install GLUT package (freeglut would be fine), which can be found in NuGet.
Open your solution, click TOOLS->NuGet Package Manager->Package Manager Console to open a NuGet console, type Install-Package freeglut.
--
For VS 2013, use nupengl.core package instead.
--
It's 2020 now. Use VCPKG.
For Microsoft Visual Studio 2017 Community GLUT installation -
Download the header, dll's and lib files fro glutdlls37beta (linked in here)
Paste glut.h in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.11.25503}\include\GL
Create the GL folder if not present already. The {thing} may differ.
Paste glut.lib in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.11.25503}\lib\x64.
Paste glut32.lib in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.11.25503}\lib\x86.
The {thing} may differ.
Paste glut32.dll in C:\Windows\System32. Paste glut.dll and glut32.dll in C:\Windows\SysWOW64.
Follow Vishwanath gowda k's answer next.
Go to Project -> Properties(All Configuration option)->Linker -> Input -> Additional Dependencies->edit(down arrow on the right end)
Type->
opengl32.lib
glu32.lib
glut32.lib
Hit Ok->apply.
For an easy and appropriate way of doing this, first download a prepackaged release of freeglut from here. Then read its Readme.txt.
I copied some important parts of that package here:
... Create a folder on your PC which is readable by all users, for example “C:\Program Files\Common Files\MSVC\freeglut\” on a typical Windows system. Copy the “lib\” and “include\” folders from this zip archive to that location ... freeglut DLL can be placed in the same folder as your application...
... Open up the project properties, and select “All Configurations” (this is necessary to ensure our changes are applied for both debug and release builds). Open up the “general” section under “C/C++”, and configure the “include\” folder you created above as an “Additional Include Directory”. If you have more than one GLUT package which contains a “glut.h” file, it’s important to ensure that the freeglut include folder appears above all other GLUT include folders ... Open up the “general” section under “Linker”, and configure the “lib\” folder you created above as an “Additional Library Directory”...
Download the GLUT library. At first step Copy the glut32.dll and paste it in C:\Windows\System32 folder.Second step copy glut.h file and paste it in C:\Program Files\Microsoft Visual Studio\VC\include folder and third step copy glut32.lib and paste it in c:\Program Files\Microsoft Visual Studio\VC\lib folder.
Now you can create visual c++ console application project and include glut.h header file then you can write code for GLUT project.
If you are using 64 bit windows machine then path and glut library may be different but process is similar.
Yes visual studio 2012 express has built in opengl library. the headers are in the folder
C:\Program Files\Windows Kits\8.0\Include\um\gl and the lib files are in folder C:\Program Files\Windows Kits\8.0\Lib\win8\um\x86 & C:\Program Files\Windows Kits\8.0\Lib\win8\um\x64. but the problem is integrating the glut with the existing one..
i downloaded the library from http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip.. and deployed the files into .....\gl and ....\lib\win8\um\x32 and the dll to %system%/windows folders respectively.. Hope so this will solve the problem...
Download and install Visual C++ Express.
Download and extract "freeglut 2.8.0 MSVC Package" from http://www.transmissionzero.co.uk/software/freeglut-devel/
Installation for Windows 32 bit:
(a) Copy all files from include/GL folder and paste into C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl folder.
(b) Copy all files from lib folder and paste into C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib folder.
(c) Copy freeglut.dll and paste into C:\windows\system32 folder.
Use NupenGL Nuget package. It is actively updated and works with VS 2013 and 2015, whereas Freeglut Nuget package works with earlier versions of Visual Studio only (as of 10/14/2015).
Also, follow this blog post for easy instructions on working with OpenGL and Glut in VS.
the instructions for Vs2012
To Install FreeGLUT
Download "freeglut 2.8.1 MSVC Package" from http://www.transmissionzero.co.uk/software/freeglut-devel/
Extract the compressed file freeglut-MSVC.zip to a folder freeglut
Inside freeglut folder:
On 32bit versions of windows
copy all files in include/GL folder to C:\Program Files\Windows Kits\8.0\Include\um\gl
copy all files in lib folder to C:\Program Files\Windows Kits\8.0\Lib\win8\um\
(note: Lib\freeglut.lib in a folder goes into x86)
copy freeglut.dll to C:\windows\system32
On 64bit versions of windows:(not 100% sure but try)
copy all files in include/GL folder to C:\Program Files(x86)\Windows Kits\8.0\Include\um\gl
copy all files in lib folder to C:\Program Files(x86)\Windows Kits\8.0\Lib\win8\um\
(note: Lib\freeglut.lib in a folder goes into x86)
copy freeglut.dll to C:\windows\SysWOW64
Create a empty win32 console application c++
Download a package called NupenGL Core from Nuget package manager
(PM->"Install-Package nupengl.core")
except glm everything is configured
create Source.cpp and start working
Happy Coding