I am facing a really for me time-expensive problem. I am new to ubuntu and want to start learning more about opengl by using the glfw. Of course I cannot switch the OS so I will have to stay at ubuntu. I have come so far that I installed the glfw( by following this "tutorial": 2. step by filipwasil), so I have got an include directory in the usr/local dir, aswell as a lib directory. The include directory contains the glfw3.h and the lib directory the libglfw3.a file. If I try to add them to my project in code::blocks it seems like only the include part works, because I can see the functions provided by the glfw while typing, but once I want to compile and run the project, I get an error for each glfw function call: like "not defined reference to e.g. glfwInit". The lib directory also contains a cmake dir, which contains glfwconfig and glfwtarget files, but I really do not know what these files should do. I also noticed the question by Artur, which is quiet identical, but it does not help me because I want to know which files exactly I have to add in order to get a running window. So may question is: How is it possible to make the code::blocks IDE, actually the gcc compiler, know whats behind the glfw functions?
Every help will be appreciated. Sorry for my bad english. :)
Add GL, GLEW and glfw in the linker settings. Note the "glfw" in lowercase
Related
I'm learning to use the Codeblocks editor and I would like to setup a SDL2 project. My question is about the necessary files in the SDL2 package.
In the bin directory there is:
sdl-config
In the lib directory there is:
directories -
cmake and pkgconfig
In the share directory there is:
aclocal
I deleted these files, but my experience with SDL2 and C++ is almost at a beginner level. My understanding is, that these support files are for various command line tools used for compilation. For example I know what pkg-config is and I searched somewhat for the other file types. Is it ok to delete these files since I am using Codeblocks, or will Codeblocks possibly require any of these in some unexpected way at a later time? that I might not have considered. As far as I know, Codeblocks makes full use of it's wizards and it's project handling is separate from these other tools. I basically like to set everything up as an Empty Project. I have no compilation issues or errors, but I wanted the opinion of someone more experienced on this.
I installed SDL2 for mingw using this guide. However, when i try to compile using the compilation syntax and test code they provide, only with my own file names, I get the error shown here. I assume that this error has something to do with a problem in the way I installed SDL, as the installation instructions did not exactly match the files with which I was provided, but I did my best to follow them. Could they problem be something else? If not what is the correct way to install SDL2 for mingw?
Note: I do have the SDL2.dll file in the sdltest folder where I try to compile the program.
One way to let MinGW know where your SDL libraries are would be to create environment variable named "LIBRARY_PATH" with the value as the path to the directory containing the libraries. Similarly, you can have "CPLUS_INCLUDE_PATH" for the headers as well.
Did you follow step 2 of that tutorial ?
Using OSX and vim...
Downloaded SDL2 from the website, then moved the SDL2.framework into /Library/Frameworks/
Using tutorial code, and Makefile... SDL.h is not found.
Makefile: g++sdl-config --cflags --libssdltest.cpp -o sdltest
I've read numerous things about pointing the compiler to the framework, but everything I've tried doesn't seem to work, and I thought /Library/Frameworks/ was the default area for the compiler to look
Got it to work.
Getting this to work took multiple tries, but the root of the issue for each try was that most of the Tutorials I was looking at were for SDL1.2 when I was using SDL2.
This changed flags in the make file, directories to search in and other things. Interestingly, I could never get the compiler to see SDL.h when it was in the /Library/Frameworks/ directory. However using Macports to install SDL2 allowed me to point the compiler to where Macports installed SDL2 header files - /opt/local/include/SDL2
That seems to have done it for me
Thank you for your question, because I was having similar difficulties! There seems to be a dearth of detailed and helpful tutorials on how to install SDL2 using Macports.
I got it working! Here are the steps:
Visit this link to find the Macports package appropriate for your version of Mac OS X. Install the version you need, and once that is done, proceed to step 2.
https://www.macports.org/install.php
After installation is done, visit this link to find the SDL2 port.
https://www.macports.org/ports.php?by=name&substr=libsdl
The one I needed was the third from the top, called libsdl2. I will be providing the name for you so feel free to visit the link simply for your own edification.
Open the Terminal, and type sudo port install libsdl2. If all goes to plan, you should see it installing and updating. Once it is complete, you should have a functional installation of the SDL2 Header files, (ending in .h), Static Library files (ending in .a) and Dynamic Library files (which contain dylib). You may have to do some poking around in Finder to locate where it installed.
The advantage of this workaround is the ability to use SDL with other IDE's besides Xcode, Eclipse for instance. Whereas Xcode requires you to assign a path of /Library/Frameworks, this technique should allow you to use the IDE of your choosing.
The final step is going into your IDE and assigning the build paths to these newly installed and compiled SDL files. For instance, the paths for mine are /opt/local/include and /opt/local/lib. Be mindful of the fact that your path may differ from these, but these examples should give you an idea of where to look.
Hopefully this is helpful for somebody!
I'm having a problem linking SDL_ttf library with C++ compiler. I have tried three different programs and i couldn't solve the problem in any of them. I've tried Dev C++, Eclipse and CodeBlocks. In all of them it appeared a different error, but all related to not finding -lSDL_ttf or not recognizing the functions of that library.
I'm following this tutorial http://lazyfoo.net/SDL_tutorials/ and have done everything i have found on the internet. I copy the .h file inside /include/SDL/ directory, the .dll files inside the project directory, and the files within /lib directory into the /lib directory that i am using. I think the error might be here, as SDL_image for example, have ".lib" files, and in ttf there is no such file. They are all ".a" or ".la". I'm new to C++ so i don't know if i am doing something wrong.
Thank anyone for his help.
The error in code blocks is the following:
ld.exe cannot find -lSDL_ttf
Make sure you downloaded the correct version of the library. If you have ".a" files, you probably downloaded the mingw version. And for that you have to use a mingw compiler. If you are using something like Visual Studio, you need the version with -VC.zip at the end.
Hope it was useful.
Good coding ;-)
I recently tried to figure out how to use freeglut with NetBeans 7.
I Google'd a lot and I didn't find a suitable tutorial on how to bind the stuff I need into it.
Currently I have more problem then this:
First one is:
- freeglut 2.8 => in order to compile it I need MinGW and msys.
I have both installed but I can't "configure" or "make all" and "make install" freeglut.
I didn't find an easy-to-read how-to for that task.
Next one:
- once built, where to put what files into a specific folder?
Last one:
- Once put the files into corresponding folder, how to use finally freeglut under NetBeans 7 on a C++ project?
I feel like a lack of information on that.
All I found are always answers like:
download, build, install and done. But I'm already stuck on the "install" and "build".
The solution:
Close NetBeans.
Install and download MinGW from mingw.org
After installing, add the Path to your SystemEnvironemt (example: C:\MinGW).
go to Start->Computer, right mousebutton, select properties
go to advanced system setting, in the following dialog press "Environment Variables".
in the tab "system variables", find the entry Path (or PATH)
add: C:\MinGW;
get freeglut pre-compiled package:
(http://www.transmissionzero.co.uk/computing/using-glut-with-mingw/)
there is a good tutorial how to set up.
Now have fun (just #include " and you're done.
have fun.
Note #1:
if you have problems finding make, the folder is:
C:\MinGW\msys\1.0\bin\make.exe
(when installed MinGW on C:\MinGW).
"mingw-get install msys" in command line should get msys...
last but not least dont forget to add msys\bin to path, too. :)
here's a full tutorial, but in german language.
http://techchan.blog.de/2012/03/18/einrichten-opengl-netbeans-7-1-1-teil-0-start-13209096/
If you need it in english, let me know if you could translate it ;) otherwise i'll think about to translate it myself.
I had a difficult time getting glut working in Netbeans on Windows 7 until I found freeglut, I attributed this to the fact that glut is just very out of date and so are the tutorials I found.
Maybe this will help others looking for instructions on using freeglut in Netbeans. These instructions are like the ones in the link already provided, but help explain how to use it in Netbeans rather than from the command line. This tutorial expects that you've already gotten Netbeans and your compiler working together. IF you have not done so, I found the guide here very helpful: http://netbeans.org/community/releases/68/cpp-setup-instructions.html#mingw
download and extract freeglut from http://www.transmissionzero.co.uk/computing/using-glut-with-mingw/ into an easy to reach folder. (I recommend C:/FrGlut)
either add the bin folder (C:\FrGlut\bin) to your Windows PATH variable, or copy the freeglut.dll from your bin folder into C:\Windows\System32
Open Netbeans and open or create your project
go to: file->project properties
Select your compiler, go to include directories, and add the path to your freeglut include folder (C:\FrGlut\include)
under linker, select add libary, and navigate to the file C:\FrGlut\lib\libfreeglut.a
select options and add the following individually:
-dynamic -lfreeglut -lopengl32 -LC:\FrGlut\lib\libfreeglut.a
Netbeans should now be ready to use with your freeglut library.
To use the glut libary add the following include to your source:
#include <GL/glut.h>
Remember that freeglut.dll will need to be shared along with your executable in order for the program to run, as most users will not already have it.