How do I set up an OpenGL/C++ project with GLM? - c++

I'm using Visual Studio 2013 for an OpenGL/C++ project and now I need to work with the GLM library.
I've downloaded the library and extracted it in my project folder. Then I set [addictional directories] from the properties of the project but it keeps giving me:
fatal error LNK1104: cannot open file 'glm.lib'
But there is not a glm.lib in the .zip on the website. Here are the "includes" in my main:
#include <GL\glew.h>
#include <GL\freeglut.h>
#include <iostream>
#include <cstdlib>
#include "imageLoader.h
#include "..\glm-0.3.2\glm\glm.h"

The website you linked only provides sources for the library. You will have to build it yourself to use it.
The source provides a Makefile.am to build the library with autotools but since you are using Visual Studio, it might be a little tricky to build it this way. On the other hand, this library is really small - only ten source files or so. It will probably be easier for you to just add these sources to you current VS project and build them with the default VSC++ compilation tools.
Also, there is a more common C++ library related to Opengl with the same name. The one you are trying to use seems to load wavefront obj files. The GLM I know is a helper 3D math library with GLSL syntax (GLM).

Regarding Visual Studio 2017 I suggest following:
I suppose you have at least one toolkit, such as GLFW, freeGLUT, SDL, in folder C:\OpenGL\ and it is set up in an empty project.
Go to https://glm.g-truc.net/0.9.9/index.html and download glm.
Drag it (or copy and paste) from the window is downloaded into folder C:\OpenGL. Now in folder OpenGL you have glm and at least one toolkit.
Go to V.S. > Solution Explorer > right click the project's name > click Properties > Open the C/C++ drop-down menu > General > Additional Include Directories > Click the down arrow at the right of the field > Edit... .
In Additional Include Directories window, click the first icon, copy C:\OpenGL\glm and paste in text box.
Click [OK] in Additional Include Directories window.
In the Linker drop-down menu, click Input. Click the Additional Dependencies entry and then the down arrow at the right of the field. Select Edit in the drop-down menu. Copy opengl32.lib and paste on the top-most text box in Additional Dependencies window. Click [OK] in Additional Dependencies window.
Click [Apply] and [OK] in the Project Property Pages window.
That's all. Regards.

Related

I Don't Know How To Use/Run These Files That Are In A Github C++ Library I'm Trying To Add To My Project?

https://github.com/gladosconn/ecdsa_cxxI have been trying to get this library into my project (C++ using Visual Studio 2022, in Windows) because I need to use the ecdsa signature algorithm, I have copied all the files in src folder to a folder called "ecdsa" in the src folder inside my project, and I didn't do anything with the test folders (I think that I don't need them since they're just tests), but then there are these files (.ytml) ,(.txt) ,(.py), I have no idea what am I supposed to do with them or where to put them, but I sure I need them because the program isn't working, it's giving me this error Cannot open include file: 'secp256k1.h': No such file or directory Libraries.Also I have done everything in the requirements section, my compiler supports C++11, and I have installed openssl, and I have CMake installed.This is my first time using anything from Github so I'm sure what to do.
In Visual Studio, right-click on your project in the Solution Explorer pane. From the menu that pops up, choose the 'Properties' item. It is usually at the very bottom. A dialog box will appear.
In the left pane of the dialog box, expand the options Configuration Properties > C++ > General. Now, in the right pane of the dialog box, probably at or near the top will be an item labeled 'Additional Include Directories`. Add the full path to the folder where you copied the source files from GitHub.
You may need to explicitly add ALL the files you downloaded from GitHub into your Visual Studio project.
Try compiling again.

How do I modify the include paths used by a Visual C++ project is VS 2015?

I am developing a simple C++ application in VS2015. I am getting the error message "Cannot open source file "math". So I right click the project in the solution explorer and navigate to the VC++ Directories, click the "Include Directories" entry in the right-hand pane, pull down the combo box and choose "".
The "Include Directories" dialog appears and is completely read only. I can click the "Macros>>" button and see a list of include macros, but there is no way to add them to your project.
All configuration-dependant properties, including the INCLUDE, are edited in the property-sheets:
Open the Tab "Property Manager", navigate to your configuration (i.e. "Debug | 64"), double click, and enter the include path there. (Save your edits)
Additional project-dependant INCLUDE: Open project's properties (project/Properties in Solution Manager. Navigate to "C++/Additional includes". There you can set additional includes, even if other parts of the property-dialog are readonly).
Math: Following include should be available from VS2015 environment:
#include <math.h>

How to build a C++ project on Xcode 4 from scratch - linking existing and new external libraries

I've been trying to build some C++ console-based programs in Xcode. I managed to open a new project (Command-Line Tool -> C++) and to edit main.cpp, but I still can't figure out two things:
how do I create new .cpp and .h files to build new libraries and especially how do I link them to main.cpp (I actually managed to create .h and .cpp files, but importing them in main.cpp with an #include doesn't seem to work)
how do I link external existing libraries? I have this Stanford C++ Libraries (from CS106B on iTunes U) which are a set of .h headers and a .o archive.
Thanks
If you're going to use your project to write C++ libraries, the first thing you must do is add a target for each library you're going to write. Open the project editor by selecting your project from the project navigator on the left side of the project window. At the bottom of the project editor is an Add Target button. Click the button. Select Framework and Library under Mac OS X. Select either C/C++ Library or STL C++ Library from the list of library targets. Click the Next button. Enter the library name in the Product Name text field. Use the Type menu to create a dynamic or static library. Click the Finish button.
After creating the library target you can add new C++ files to it. When creating a new C++ file, make sure you add the file to the library target, not the tool target. Select the library target checkbox in the Save panel.
At this point it's time to link libraries to the tool target. Select the tool target from the target list on the left side of the project editor. Click the Build Phases button at the top of the editor. Click the disclosure triangle next to the Link Binary with Libraries build phase. Click the + button to link to an existing library.
You may want Xcode to build your library targets automatically when you build the tool target. To get Xcode to do this, click the disclosure triangle next to the Target Dependencies build phase. Click the + button to add a dependency. Choose one of your library targets in the sheet that opens.
You're going to have to provide more information to get anyone to answer your question regarding getting main.cpp to include the new files you create. At a minimum you have to provide code on how you are including the header files in main.cpp and what you mean when you say #include doesn't seem to work. The following include should work:
#include "NewFile.h"
Where NewFile.h is the new header file you created.

Adding files to be used by #includes

I'm starting with a new Win32 console app project in Visual Studio 2010. I am setting up my environment to support beginner level OpenGL programs. I am in the process of adding required *.cpp files and *.h files. I added
#include "../../shared/gltools.h"//opengl toolkit
Error "cannot open source file" is displayed when I hover over #include. I attempted to add the required file. I right click Source files and choose > Add > New Filter > called it shared and hit enter.
What is a filter? I thought I would be adding a physical folder rather than a filter. How does this differ from "External Dependencies"?
In the project properties, unde Compiler, find the field Additional Include Directories and add the directory where the file is located, or, alternatively, the directory where /shared/ is located.
find and analyse some of the OpenGL samples, these are most often with OpenGL headers and libraries which clearly you have. Check which include directory you are using - configure that as 'Luchian Grigore' above described. When you have that working (program compiles) remember to add library directories (in project settings, linker options) or there will be linker problems. This all should be described in howto or code samples. Analyse them to get started. Don't reinvert the wheel and have fun.

how to link the fmod library in visual studio

I am just a beginner at windows programming and was reading a tutorial about it.
It said something about resources for menu creation.
I am working in visual studio 2010 and would like to know how to create these resources (the turorial said something about adding them to the compiler which i could not understand) for simple things like menu bar creation.
Please help me.(Please keep in mind that I am a beginner therfore explain in detail if possible.)
To actually use the additional functionality you have to include the header and specify the directory where it is contained so the project can find the file
right click on project->properties
C\C++->general tab
the top element is Additional Include Directories - click the down arrow and specify the path to the header file
For your application to use the functionality you have to link with the lib
right click on project->properties
Linker->general tab
The 9th element from the top is Additional Lib Directories
& specify the path to the accompanying lib file
NOTE that the dll that corresponds (if dynamically linked) must be either in the system path or in the working directory of your application
under the linker -> input tab
you'll want to specify the name of the .lib file to load (the same as the file contained within the path you specify to link with with)
Alternatively - if the you'd like to make a project depend on another project within the same solution
right click the project->properties
the top tab is Common Properties
within that tab click the button "Add New Reference" and select the project