cairo + openGL + Glut + VS 2010 + Windows 7 - c++

I'm pretty dump :) So could anybody help and write step-by-step manual, how to install "cairo", "glut" and use it in VS 2010 project (C++) on Windows 7?
PS: the most fun thing that i managed to do that without any problem in Linux.

I don't know cairo, but setting up GLUT is rather straightforward.
Download FreeGLUT
Unpack the downloaded archive
Go the directory unpack-dir/freeglut-x.x.x/VisualStudio2008
Open the visual studio project
Rebuild the project for each target (release, debug) you want to create
This should create a DLL file and a lib file with the same name. Now if you want to create a new project that uses GLUT, just configure the project correctly:
Create new project
Create a main C/C++ file (otherwise, you won't be able to set the include settings)
Go to project settings (right click project -> Configuration properties)
C/C++ -> General: add the freeglut include directory to Additional Include Directories
Linker -> General: add the path to the built .lib (freeglut) file under Additional Library Directories
Under Linker (input) settings: add the name of the .lib file under Additional Dependencies
If you follow this setup, you should be able to use GLUT (#include <GL/glut.h>) in your code and it should compile nicely. Not sure how you can also add cairo, but it will probably be a very similar process.

Related

How to add a library to my project in a visual studio 2019?

I needed to use zydis library in my VC2019 cpp project.
I have no idea how can I add it to my current project - I downloaded it from github.
There is msvc folder, inside I can find .sln file, some header files and .vcxproj files - what should I do, to just include it into my project and use it?
It can be done by adding a reference to the DLL file.
In Visual Studio, right click on the project, Add Reference. Give the path to the DLL file and add it to the project.
First, I suggest that you could download and install Zydis using the vcpkg dependency manager. The method is easy and convenient.
If you don't use vcpkg, you could follow the steps below.
Open the Zydis.sln in msvc with VS2019.
Copy files in include/Zycore, put them in zydis-master\include\Zycore. Because I find that there should be missing files when I compile Zydis.sln.
Right click Zydis, set Visual Studio 2019(v142) in Properties->General->Platform Toolset.
Compile it, and you will find Zydis.lib in zydis-master\msvc\bin\DebugX64.
Then, you could copy include floder and lib in your program floder.
You could set VS:
Right-click the project, select Properties->Configuration
Properties->C/C++->General, find the Additional Include Directories and set the directory.
Properties -> Configuration Properties -> Linker ->
General, find the Additional library directory in General, and set the lib.
Properties -> Configuration Properties -> Linker -> Input,
find Additional Dependencies and input the lib name.
Besides, you could set five build configurations.

How to use SDL locally in Visual Studio 2013

I want to add SDL and SDL_image to my Visual Studio project. But can I do it locally only for this project? I don't want to put the dlls in System32 folder.
As described by Ciprian Khlud, you could simply put your DLLs next to the output binary (.exe). You could find output directory in
Right click on project -> Project Settings -> General -> Output Directory
Alternatively, you could add the folder where DLLs are into the list of search directories:
Right click on project -> Project Settings -> VC++ Directories -> Executable Directories
(same way as you add include dirs and library dirs)
An easy way is to copy them either manually into your output folder or to create a post build event.
Use Microsoft link to see where you can put your Dlls without conflicting with System32:
https://msdn.microsoft.com/en-us/library/7d83bc18.aspx

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.

GStreamer C++ on Visual Studio 2010?

Following instructions on http://docs.gstreamer.com/display/GstSDK/Installing+on+Windows to install GStreamer and compile tutorials/examples on Windows 7, for compilation using Visual Studio 2010.
After installing the SDKs, I try to compile the "hello world" example...
Cannot open include file: 'gst/gst.h': No such file or directory.
Odd - the tutorials were supposedly configured with the paths to these files. Nevertheless, we can manually add them...
Add C:\gstreamer-sdk\0.10\x86\include\gstreamer-0.10 to project include directories
Cannot open include file: 'glib.h': No such file or directory
Add C:\gstreamer-sdk\0.10\x86\include\glib-2.0 to project include directories
Cannot open include file: 'glibconfig.h': No such file or directory
At this point it seems to be a dead-end, as there isn't a glibconfig.h file anywhere on PC.
Was some step missing from the gstreamer documents?
p.s. I see a similar question, but its accepted answer seems to be a dead-link.
This question was posted on 2014. However, for everyone that needs to install Gstreamer on Visual Studio , I am explaining how you configure your library on Windows.
First of you need to download the library from https://gstreamer.freedesktop.org/data/pkg/windows/
You need to download and install both installers for developers and non-developers.
For instance for 1.14 it is the now latest version,
gstreamer-1.0-devel-x86-1.14.1.msi
gstreamer-1.0-x86-1.14.1.msi
You will install and setup both of them in the same directory like C:\gstreamer. (I guess gstreamer automatically adds its /bin to the Path environment. If not just ask it.)
After that you will open your Visual Studio. Create your C++ project. Create your main.cpp file. Right click on your project and click properties.
We need to do 3 steps:
Include the necessary directory paths.
Define the where the .lib paths are.
Specify which .libs you want to use.
After clicking properties:
C/C++ -> Additional Include Directories -> define your include paths such as
C:\gstreamer\1.0\x86_64\lib\glib-2.0\include;C:\gstreamer\1.0\x86_64\include\gstreamer-1.0;C:\gstreamer\1.0\x86_64\include\glib-2.0\;C:\gstreamer\1.0\x86_64\include\glib-2.0\glib;%(AdditionalIncludeDirectories)
Linker -> General -> Adding Library Directories -> write your lib directory path such as
C:\gstreamer\1.0\x86_64\lib;%(AdditionalLibraryDirectories)
Linker -> Input -> Additional Dependencies -> Write your .lib files you want to use such as
gobject-2.0.lib;glib-2.0.lib;gstreamer-1.0.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
gobject-2.0.lib;glib-2.0.lib;gstreamer-1.0.lib are the ones we added, others are done by default.
That's all. You can just write in your main.cpp file
#include <gst/gst.h> and use your GStreamer Library
I think this will work for almost all libraries.
(1) Install Windows Driver Development Kit
(2) When creating new projects, use the "gstreamer" template in Visual Studio, rather than the "Windows application" template. Then it doesn't need anything changing in the include/linker settings to make #include <gst/gst.h> work properly.
The standard gstreamer installation on windows has a glibconfig.h located in: (assuming your gstreamer installation is in C:\gstreamer) C:\gstreamer\1.0\x86_64\lib\glib-2.0\include
The official way is using the "Property Sheet" feature of Visual Studio.
In Visual Studio, click View→Property Manager or View→Other Windows→Property Manager on the menu bar.
Click Property Manager tab near the Solution Explorer.
Right click your project name and choose Add Existing Property Sheet..., and navigate to %GSTREAMER_ROOT_X86%\share\vs\2010\libs and load gstreamer-1.0.props.
This will add Addittional Include Directories, Addittional Libraries Directories and Additional Dependencies to your Project Properties.
Build your project.
Sources:
Creating new projects manually:
https://gstreamer.freedesktop.org/documentation/installing/on-windows.html?gi-language=c#creating-new-projects-manually
Share or reuse Visual Studio project settings:
https://learn.microsoft.com/en-us/cpp/build/create-reusable-property-configurations

Linking Boost to my C++ project in Eclipse

I'm trying to get the Boost library working in my C++ projects in Eclipse. I can successfully build when using header-only libraries in Boost such as the example simple program in the "Getting Started" guide using the lambda header.
I cannot get my project to successfully link to the regex Boost library as shown later in the guide. Under my project properties -> c/c++ build -> settings -> tool settings tab -> libraries, I have added "libboost_regex" to the Libraries box, and "C:\Program Files\boost\boost_1_42_0\bin.v2\libs" to the Library search path box since this is where all the .lib files are. I've even tried adding "libboost_regex-mgw34-mt-d-1_42.lib" to the libraries box instead of "libboost_regex" since that is the exact file name, but this did not work either.
I keep getting an error that says "cannot find -llibboost_regex" when I try to build my project. Any ideas as to how I can fix this?
Edit: on Windows XP, using mingw, and I have tried "boost_regex" as well..
I just went through the whole process of installing MinGW, compiling boost and installing Eclipse CDT and I'm able to compile simple programs using boost:regex. I'll write down all the steps. I hope that can be of help.
I've installed MinGW and MSYS in their default location.
Here are the step I took to build boost:
Download boost-jam-3.1.18-1-ntx86.zip from http://sourceforge.net/projects/boost/files/boost-jam
Put bjam.exe somewhere in your PATH
Unpack boost in C:\mingw\boost_1_42_0
Open an msys terminal window and cd /c/mingw/boost_1_42_0
In the boost directory run bjam --build-dir=build toolset=gcc stage
To configure Eclipse:
Add CDT to Eclipse 3.5 from the update site
Create a new C++ project
Under the Project menu select properties
Make sure the configuration is Debug [Active]
In "C/C++ General" > "Paths and Symbols"
Under the Includes tab select the GNU C++ language and add C:\MinGW\boost_1_42_0
Under the Library Paths tab add C:\MinGW\boost_1_42_0\stage\lib
In "C/C++ Build" > "Settings"
Select MinGW C++ Linker > Libraries
Click on the add button for Libraries (-l)
Type libboost_regex-mgw34-mt-d (without the .lib)
You can then go through the same steps for the Release configuration but use libboost_regex-mgw34-mt instead. Also make sure your source files include <boost/regex.hpp>
To link to boost library in eclipse you need to set both the eclipse's project library path(the one with the -L) and the name of the library(the one with the -l).
The prefix 'lib' and the extension of the library's name must be removed:-
eg: libboost_regex.a should be specified as boost_regex.
I believe your lib path is pointing to the wrong place. The libs will be installed to:
boost_install_dir\boost_1_42\lib
I think the default boost_install_dir is "C:\Program Files\Boost" (not sure because I don't use the default install directory).