Opengl: where do I find freeglut.dll in freeglut (extracted .tar file)? - opengl

I am trying to install OpenGL in the Microsoft visual studio(professional of community version). I have downloaded glew and freeglut(.tar file). In installation steps, I learn that freeglut.dll and glew32.dll files need to be copied into certain location in visual studio. But not able to find the freeglut.dll anywhere in the extracted freeglut (.tar) file. How do I need to proceed? How to finally get OpenGL installed?

Don't use the tar file, you need the zip file.
You can get it here: http://www.transmissionzero.co.uk/software/freeglut-devel/
Direct download link: http://files.transmissionzero.co.uk/software/development/GLUT/freeglut-MSVC.zip

Related

cannot see the file 'SDL2.lib'

This question is not a duplicate of cannot open file 'SDL2.lib' which discusses this same error but my problem is that I don't have an SDL2.lib file, if I can just see it I can make this work
I'm trying to set up the development environment for SDL2 by following Lazy Foo's tutorial.
Setting up SDL 2 on Visual Studio 2010 Ultimate
The tutorial is for Visual Studio 2010, I'm using Visual Studio Community Edition 2017. Is that a problem?
The problem starts when linking the libraries, there is no x86 or x64 folder inside the lib directory of SDL2's Windows Development libraries that I downloaded from SDL version 2.0.8 (stable).
So I specified it as lib/ instead of lib/x86 as it says in the tutorial.
These are the files inside the lib folder
$ ls
cmake/ libSDL2.dll.a libSDL2_test.a libSDL2main.a pkgconfig/
libSDL2.a libSDL2.la libSDL2_test.la libSDL2main.la
When building VS2017 is throwing an error saying that Cannot open file 'SDL2.lib'. Yeah, there is no such file. Do I need to do an additional step to get this file?
When I configured for CodeBlocks it works fine. What exactly am I doing wrong here? This may have an obvious answer but I'm not able to find it.
Library name `libSDL2.dll.a' indicates that it is not meant for use with VS C++ ( for dynamic link you need dll + lib, for static link you need only the lib ). You can construct a lib file from dll using dumpbin.exe and lib.exe. Your options are:
1) Download SDL source file in zip format from GitHub and create you own binaries.
2) Use vcpkg and install in just one command line ( recommended).
3) Download the SDL binaries from internet. ( you can have linker issues if the project configurations doesn't matches yours)

Cannot load any image with CImg

Any time I try to load an image I get an error saying CImg<unsigned char>::load(): Failed to recognize format of file. This happens for both jpg and png files.
I have found other posts about this saying to define cimg_use_png and cimg_use_jpeg, but then I get compilation errorstelling me I need png.n and jpeglib.h. Not sure where I'm supposed to get these from.
I'm not sure where I've gone wrong, so I don't know what to ask specifically. What's gone wrong?
If you want to open JPEG images, you need to install libjpeg and compile and link against it.
If you want to open PNG images, you need to install libpng and libz (for the compression) and compile and link against them.
At the moment, you should be able to use NetPBM format images - i.e. PBM, PGM and PPM.
Well, after two painful days of trying to work out how on Earth Visual Studio 2017 works, and how to install and integrate libjpeg with it, I can now explain how to install CImg and libjpeg on Windows.
Step 1
You need to have Visual Studio 2017 installed, which means you need Windows 7 with SP1 or better. When installing it, be sure to include "Windows 8.1 SDK"
Step 2
Download libjpeg from the IJG website. I took jpegsr9b.zip as it is the latest.
Step 3
Unzip the file and store it in a directory called libjpeg in your HOME directory.
Step 4
Go to Start>All Programs>Microsoft Visual Studio 2017>Visual Studio Tools > Developer Command Prompt for VS2017
Navigate to the directory you just unzipped. That will be something like this:
cd libjpeg
cd jpeg-9b
Step 5
Now you are going to need to find a file called win32.mak. I found mine in C:\Program Files\Microsoft SDKs\Windows\v7.0\Include. Yours may be somewhere else if you have Windows 8.1 SDK. Anyway, wherever it is, you need to add its containing directory to your includes. So I did:
set INCLUDE=%INCLUDE%;C:\Program Files\Microsoft SDKs\Windows\v7.0\Include
Step 6
Now run nmake to get your SLN - some weird Microsoft "solution" file. The command is:
nmake -f makefile.vc setup-v10
And you should get a file called jpeg.sln - hurray!
Step 7
Now start Visual Studio 2017, and open the jpeg.sln file you just created and build the project. It will create a Release directory in your libjpeg directory and inside the Release directory you will find jpeg.lib. You have now installed libjpeg.
Step 8
Close that project, and start a new C++ command-line project and write your CImg-based program. I wrote the simplest ever:
#define cimg_use_jpeg
#include "CImg.h"
using namespace cimg_library;
int main() {
CImg<unsigned char> img("C:\\Users\\Mark\\test.jpg");
img.display("Image");
return 0;
}
Step 9
Download CImg.h from Github, and save it in a directory called CImg in your HOME directory.
Step 10
Now tell Visual Studio where the include files (for CImg and libjpeg) are and where the library files (for libjpeg) are:
Step 11
Now tell Visual Studio 2017 that you want to link with libjpeg:
Step 12
Now you can compile, link and run your CImg program and load JPEG files and display them on the screen!
If you are using cmake on Linux/macOS, this answer shows you the way.
If you are compiling on macOS from the command line, you'll need to have XQuartz installed if you are display images on the screen, and you'll want something like this:
g++ -std=c++11 sample.cpp -o sample -I /opt/X11/include -L /opt/X11/lib -lX11 -ljpeg -lpng -lz
If you want CImg to work with jpeg or png images, you need to supply appropriate library.
Here's a tutorial how to install libjpeg to Visual Studio project. It's basically a 2019 update to Mark Setchell's answer.
How to install libjpeg to your project
Download jpegsr9c.zip (or newer) zip with source code
Extract the archive to a folder.
Copy the address of the folder extracted from archive
Search for Developer Command Prompt in Start menu
Navigate to extracted folder in Developer Command Prompt:
cd "C:\Users\HP\Downloads\temp\jpeg-9c"
Use right click to paste.
Run this command:
NMAKE /f makefile.vs setup-v15
Open jpeg.sln (which was now created).
In Solution Explorer, right click on the project. Select Retarget projects. Confirm prompt.
If you want to build your project for 64-bit platform: Right click on solution, select Configuration Manager and add new platform x64
Build solution
Now let's move to your project with CImg. Create a folder jpeglib in your project (it's IncludedLibraries\jpeglib for me). And add it to Project Properties -> C/C++ -> Additional Include Directories and to Project Properties -> Linker -> Additional Library Directories
Add jpeg.lib to Project Properties -> Linker -> Input -> Additional Dependencies
Copy x64/Release/jpeg.lib to this folder.
Search for all header files (`.h) in jpeg project and copy them to this folder.
Add #define cimg_use_jpeg before #include "CImg.h" in your project
All done! CImg is now able to read and save jpeg files.

sfml-graphics-2.dll is missing from sfml lib folder

I'm new to c++ and sfml, and I've been trying to install sfml 2.3 on my computer for making games with c++ in code::blocks. I downloaded sfml and watched this video on how to set it up. I followed everything to the letter. When I tried to run the sample code from the sfml tutorial I got this error: This application has failed to start because sfml-graphics-2.dll was not found. Re-installing the application may fix this problem. I searched for solutions to my problem and found someone suggesting to move all the .dll files from your library into the area where the program would run. I went to my library folder in my sfml-2.3 folder, and looked for anything with a .dll ending. I found zero files with this ending. All of the files in this folder end in .a, so I watched another video on how to install sfml with code::blocks this video showed the sfml library folder with a number of files that ended in .dll I searched my computer for all sfml-graphics-2.dll files and came up with zero files again. I then downloaded every different version of sfml and couldn't find any .dll files in any of their lib folders. Am I missing something, or do I just not have the .dll files, and if I don't where can I get them? I'm running widows xp if that helps.
.a is a Linux file extension for static libraries (Unix 'ar' archive). If you are on a Windows platform, download the correct version on SFML website. Dynamic libraries (DLL) are usually located in SFML-2.3/bin folder. You need to move the ones with a '-d' suffix in your Debug folder and the ones without in your Release folder to be able to run your program properly.

Install OpenCV 2.4.7 in Windows 7 for any editor

I have problem with installing OpenCV under Windows 7 x64. Following this. Downloaded executable and ran it. But I do not see any bin folder, instead there are 2 folders: build and source. What to do next I do not know, what to include to system path and how?
Note:
I am not using visual c++, instead I use devcpp editor.
The OpenCV windows installer comes as a self-extraction program. It essentially packs everything including the source files, docs, and most importantly, the pre-compiled files.
The pre-compiled files are located in build, and sources files are located in source. If you are intented to use opencv libraries solely, all you need to do is to
add build/include/ into your IDE additional include list.
selectively add build/lib/.. into the additional link list according to your vs version.
add build/bin/ to your system PATH, so your program can find them.

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