Bashing my face against the ArcSynthesis.org brick wall.

Started by
10 comments, last by georger.araujo 9 years, 8 months ago

Hello there I am trying to learn to make graphical programs in C++, I'm novice, but capable of simple console programs, but I want to move beyond that and start using OpenGL and graphics. My editor of choice is codeblocks and I have made absolutely zero progress in this mission for about two months now.

So I started looking at the http://www.arcsynthesis.org/gltut/ series again and this time got as far as downloading the tutorials and the pre-make utility.
I even managed to get premake to compile the code into a codeblocks-compatible format. But when I go into the code and run the framework.cpp. It fails to run with "You must select a "host" application to run a library", although I hadn't actually opened any of the cpp files which may be where the problem accurred
However, witness the install instructions provided with the code: http://www.arcsynthesis.org/gltut/Building%20the%20Tutorials.html
It gives only the very vaguest hints as to what to do with the downloads, and quite frankly, it doesnt tell you what to do with (whatever file it makes) when you premake the opengl library files. It assumes you've done the same operation for years and just "know" what to do. What is the purpose of a tutorial that just assumes you know what to do?
What I did:
* Download Tutorial files, premake and the Unofficial OpenGL SDK, and unzip them
* Ran premake on a tutorial to make it codeblocks freindly.
* Ran premake on the OpenGl stuff to do... something?
* I cant exactly remember now but I copied most of the folders from the opengl directory into the tutorial code's directory as I assumed it would need it in there to be able to find and use it.
* Opened codeblocks and ran said tutorial.... I get the following build errors:
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lglloadD
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lglimgD
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lglutilD
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lglmeshD
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lfreeglutD

If anyone has any experience this, can you advise what to do next?
Alternatively, if someone can come up with a step by step (unassuming guide) to every single step, from installing everything to making this pressing F9 and making this code work, i would also be happy with that.
Additionally, if anyone can advise a better programming language than C++ which is good for (hopefully, eventually) modern day fancy graphics, which isnt a completely deliberate nightmare to even run example code. Please do tell me.
In the old days (the BASIC days) you could just put a file in a directory, type "include ####" and it just worked.

Nowadays: You have to convert sourcecode into an IDE-freindly format (because they're all read c++ in different ways), you have to compile OpenGL source code into a an ide freindly version that it can use. You also apparently have to have about 5 different versions of OpenGL (glew, gltut, freegl, glib and god knows what else) You then, presumably have to tell the IDE where this version is.... and who knows what crazy unintuitive stuff beyond that...
Advertisement

Frankly it's not an old vs new thing, its a C++ thing. I started using C++ when it was a new fangled thing and you had to do this crap back then too. The errors you are getting is because the linker isn't finding libraries it needs. The D suffix means it's looking for the debug versions. I havent seen the tutorial you are looking at, and don't have time to help you right now, but ultimately it is a linker setting that you are missing.

What is the purpose of a tutorial that just assumes you know what to do?

That's, um, exactly what a tutorial is for. It demonstrates how to do a specific thing, but assumes you are familiar with the supporting knowledge. It's why tutorials can very often be horrible ways to learn things.

That said, the Arcsynthesis site is a little broader than a tutorial. However, it's focus is still to teach you things about OpenGL, and not the subtle rigors of cross-platform C++ projects (which can be exceedingly complicated and a subject for their very own book). Providing source code and compilation instructions seems to be done more as a cursory favor than a really dedicated effort.

The errors you are listing are linker errors, not compiler errors. They indicate that the references libraries (glloadD and so on, which appear to be part of that Unofficial OpenGL tutorial) aren't being found in the linker search paths. You should do two things next:

First, verify that you actually have files named "gllloadD" and so on (probably with .lib or similar extensions) somewhere. Perhaps you acquired a bad copy of the tutorial source archive that is missing these files (the website claims they should be included in the distribution and do not need to be externally downloaded).

Then, look at the (premake-generated, it sounds like) project file in your IDE: specifically look for the section that defines the library search paths for the linker. Verify that one of the paths is the directory containing the glloadD, et cetera, files.

Nowadays: You have to convert sourcecode into an IDE-freindly format (because they're all read c++ in different ways), you have to compile OpenGL source code into a an ide freindly version that it can use. You also apparently have to have about 5 different versions of OpenGL (glew, gltut, freegl, glib and god knows what else) You then, presumably have to tell the IDE where this version is.... and who knows what crazy unintuitive stuff beyond that

You don't have to do that at all. The author has provided a premake-based setup for you to allow you to generate projects for your preferred IDE; this is hardly required for C++ and is done so as a convenience for you. In this case you've run into an issue with the convenience, but that doesn't mean you wouldn't run into different issues if the author just gave you the source code and told you to compile it and resolve the dependencies yourself.

The OpenGL issues are simply the way OpenGL works -- all of those things you mentioned are not, incidentally, OpenGL -- they are utilities for making OpenGL easier to deal with. If they were there, you'd have even more problems. I appreciate that you are frustrated because things aren't working right, but in this case the author has done a fairly commendable job of trying to simplify your life (cross-platform, cross-toolchain C++ is complicated), especially given that the purpose of his/her site is not to teach you about all the complex issues surrounding distributing C++ to an unknown target environment.

It gives only the very vaguest hints as to what to do with the downloads
It tells you exactly what you have to do: Create a project file with premake.

If you want to build all of the tutorials at once, go to the root directory of the distribution and use Premake on the premake4.lua file in that directory. It will put all of the tutorials into one giant project that you can build.
Then you can just open it on Code::Blocks and you'll have a list of all the tutorials.

I started with OpenGL learing from that same site, spent a couple months with it, and I know jack shit about C++.

But to be fair, I moved soon after to LWJGL to use OpenGL in Java. Which meant I could just add jar + natives folder to a project in Eclipse and I was good to go.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Ok, I compiled all the tutorials, went into the first tutorial (which has only a single file), loaded and ran it and it gave the same build errors, so it's not a single-tutorial problem, theres something wrong with all the tutorials, or its not finding something it wants (but i have no idea because the error messages arent clear enough).

Chubu, can you try and see if you can get any to work and if so do a fresh installation of everything and write a step by step guide? Because otherwise I'm completely screwed.

If you really want to use C++ for everything, you would probably benefit more from learning the language itself and a specific toolchain (not that they're very different).

Here is a gcc tutorial which may or may not be good:

https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html

Using GLFW on Linux:

http://stackoverflow.com/questions/17768008/how-to-build-install-glfw-3-and-use-it-in-a-linux-project

Since I'm very familiar with GLFW, I can say that the tutorial above is not the most effective solution, but it will (always) work. Many roads and all that.

For windows this one looks promising:

http://antongerdelan.net/opengl/hellotriangle.html

Bottom line is, if you know how to compile and link stuff, suddenly you can use any library. The process of compiling other libraries such as GLFW and GLEW are largely very simple because the process is described in detail on their sites, or is a quick google search away. stackoverflow is littered with people having "undefined references" when trying to use libraries. Should be smooth sailing using any of the answers from there.

As with everything though, some things are not always said in clear text. Here are some pitfalls:

1. Do you have the correct compiler visible and available from shell/cmd? gcc --version

2. Do you use the correct compiler architecture, or is it a cross compiler which means you will have to specify output architecture, eg. -m64 for 64bit?

3. Do you have the correct libraries? Are they also of the correct architecture? Were the libraries compiled by you? (good) Or did they come precompiled? (potential issue)

4. Does the static or dynamic version of a library require a specific "global" #define? eg. GLEW_STATIC or GLFW_DLL. If yes, you can either #define GLEW_STATIC just before #include <GL/glew.h>, OR you can define it in your makefile as part of the compilation process: -DGLEW_STATIC

5. Do you append all the correct dependencies for the library you are using? On windows glfw requires these: gdi32 and opengl32. These are added by appending -lgdi32 -lopengl32 to the linker commandline.

6. Are the dependencies supplied in the correct order? gcc/g++ requires the dependencies to be supplied in reverse, so the first dependency is the last one in the commandline: -lglfw3 -lgdi32 -lglew32s -lopengl32

From the last point we can see that both glew and glfw requires opengl32. But glew only requires opengl32, while glfw also requires gdi32.

7. How do you know about dependencies and such?

By reading the manual:

Compiling GLFW: http://www.glfw.org/docs/latest/compile.html

Using a project with GLFW: http://www.glfw.org/docs/latest/build.html

You can also use verbose output from gcc/g++ and check for yourself what it's looking for. If you get undefined references to what REALLY looks like glfw functions, then you can rule out everything else but glfw itself. It's clear that glfw that isn't a part of the linker process and must be added before the undefined references can go away.

<everything>

Thanks for all that, if that was intended as somehow to answer and solve why these examples don't work, well then i give up on c++ because its just too complicated to learn. Not the code, but how to even get a simple example to run. I mean no disrespect at all, but I don't understand a single thing in your post.

Can anyone at all actually help with what is wrong? I followed the path given in the build error log and ended up at:

C:\Program Files (x86)\CodeBlocks\MinGW\mingw32\bin\ld.exe

It is a real EXE, but according to the errors, it must be missing some parts that make the tutorials work. Can anyone share an updated version of the exe file that works?

<everything>

Thanks for all that, if that was intended as somehow to answer and solve why these examples don't work, well then i give up on c++ because its just too complicated to learn. Not the code, but how to even get a simple example to run. I mean no disrespect at all, but I don't understand a single thing in your post.

Can anyone at all actually help with what is wrong? I followed the path given in the build error log and ended up at:

C:\Program Files (x86)\CodeBlocks\MinGW\mingw32\bin\ld.exe

It is a real EXE, but according to the errors, it must be missing some parts that make the tutorials work. Can anyone share an updated version of the exe file that works?

Hey now, if you don't want to bother with all these things there are other perfectly good languages that are much much easier to get started with.

In C# you have the best IDE around, and everything just works. It also have git (version control) integrated in the IDE, so you can one-click yourself to victory. (There's probably some videos on youtube on how to use it)

Others that are good are Java and Python. Most importantly all 3 of these languages have a huge userbase, and that means there's a ton of material out there you can use to get help with.

All of the languages above are perfectly capable of running games. You may not want to try to make high-end studio-quality 3D games in C#, but you are not a studio, you are just one man. As are we all here, for the most part. Just use whatever you like the most. If programming is your hobby, much like it is mine, you need to make it easy for you to get motivated, and that usually means not getting stuck / hitting a wall on the things you don't care about at all.

C++ is fine and all, but just because you are programming in C# doesn't mean you can't come back to C++ later and feel like you've seen it all before. All the common, modern programming languages have many many things in common with mostly syntactical differences.

For a more comprehensive list of the languages, use the search bar here at gamedev. Here is a thread from 2012 which is just as true today:

http://www.gamedev.net/topic/624131-language-comparison/

As for your actual error, you need to provide the errors in full, otherwise no one can really help you. No one here is likely using the projects from arcsynthesis, simply because we make our own projects from scratch when needed. It allows for better control and it's actually quite quick to set up once you've done it a few times.

I wrote some guesswork here, but truth is I have no idea what's wrong simply based on you pasting the full path to the linker (ld)

I would focus on getting the 'build' you downloaded to work.

Create a new project, set it up and copy in the code, that way you'll learn the basics of setting up a project/ compiler (which you'll need anyway when you start coding :))

Good luck

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

What I did:
* Download Tutorial files, premake and the Unofficial OpenGL SDK, and unzip them
* Ran premake on a tutorial to make it codeblocks freindly.
* Ran premake on the OpenGl stuff to do... something?
* I cant exactly remember now but I copied most of the folders from the opengl directory into the tutorial code's directory as I assumed it would need it in there to be able to find and use it.
* Opened codeblocks and ran said tutorial.... I get the following build errors:
If anyone has any experience this, can you advise what to do next?

I did the steps described below using Code::Blocks 13.12 with the TDM64 bundle of TDM-GCC in 32-bit mode (which I downloaded from the TDM-GCC website, this is NOT the one bundled with Code::Blocks). But I don't really see a reason why it shouldn't work with any other MinGW installation.

Open a command prompt in the Tutorial 0.3.8\glsdk folder, run premake4.exe codeblocks, and you should get a shiny new glsdk.workspace file in it. Open this file in Code::Blocks, click "Build" in the menu bar, then click "Build workspace". After the build is done, you should have static libraries of the Unofficial OpenGL SDK ready for the tutorials to link against.

Now in the Tutorial 0.3.8 folder, run premake4.exe codeblocks again, and you should now have a brand new AllTutorials.workspace file in it. Open this file in Code::Blocks, but don't yet click "Build"/"Build workspace":

1) Right-click the Tut 12 Scene Lighting project in the project tree and click "Build options...", click the root target (above "Debug" and "Release") at the left-hand side of the screen, and under the "Compiler settings" tab click the "Other options" tab. Type -fpermissive and click OK. Do the same for the Tut 12 HDR Lighting, Tut 12 Gamma Correction, and Tut 16 Gamma Landscape projects.

2) Now click "Build"/"Build workspace". All projects should build fine.

Now some bad news. I tried the compiled EXEs; most ran, but a few crashed:

- All Tutorial 12 projects;

- Tut 13 Basic Impostor;

- Tut 14 Basic Texture and Tut 14 Material Texture.

I also built everything with VS2013 and the same projects crashed. I suppose it could be either a problem with my graphics drivers (Intel HD Graphics 4000) or a bug in the tutorials; you'll just have to try and run them on your computer.

This topic is closed to new replies.

Advertisement