SortingVisualizer icon indicating copy to clipboard operation
SortingVisualizer copied to clipboard

Can you please give a tutorial as to how to compile this? Trying to compile using g++ fails

Open obipoketbobo opened this issue 4 years ago • 5 comments

obipoketbobo avatar Dec 05 '20 16:12 obipoketbobo

I've figured out how to compile this today. The repository indeed lacked libraries, the font asset and had a few errors in the code with the libraries I've obtained, which were fixed easily.

The following libraries are needed:

  • freetype2
  • glew
  • glfw
  • glm
  • portaudio

You also need the font Arial as a TTF file, which has to reside in the running working directory.

Once you got the libraries linked, and the font file provided, it should build and work. However, I had some issues on my end while trying to build at first which had to be fixed in code:

  • For the audio, it included <PL/portaudio.h>. I had to remove the PL/ in my copy of the code since my referenced library didn't use that.
  • The rest of the compiler errors were confusion between different ways to access a character in a string using the [] operator. I went with the one using "unsigned int" by changing some counter variables from "int" to "unsigned int".

Here is my fork where I could make it work: https://github.com/GabCM/SortingVisualizer

I've used CLion to assist me in building the CMakeList.txt file and fixing code errors, and I could build it with VS 2019 and MSVC 14 on Windows. In my repo, the required libraries are linked as submodules and the arial.ttf file is supplied. All of the libraries and the font file are linked together in a single CMakeLists.txt. I'm pretty sure you can at least attempt to make the code build with any build method (like g++) and platform.

Kenshiro166 avatar Dec 06 '20 00:12 Kenshiro166

When I tried to build your fork with all of the libraries, it gave me these errors, but as far as I know these are the only other issues with building it. image

obipoketbobo avatar Dec 06 '20 20:12 obipoketbobo

There seems to be an issue with glew about an experimental version.

obipoketbobo avatar Dec 06 '20 20:12 obipoketbobo

When I tried to build your fork with all of the libraries, it gave me these errors, but as far as I know these are the only other issues with building it. image

It seems you have tried with Visual Studio. Which compiler have you used?

Kenshiro166 avatar Dec 09 '20 21:12 Kenshiro166

I've figured out how to compile this today. The repository indeed lacked libraries, the font asset and had a few errors in the code with the libraries I've obtained, which were fixed easily.

The following libraries are needed:

* freetype2

* glew

* glfw

* glm

* portaudio

You also need the font Arial as a TTF file, which has to reside in the running working directory.

Once you got the libraries linked, and the font file provided, it should build and work. However, I had some issues on my end while trying to build at first which had to be fixed in code:

* For the audio, it included <PL/portaudio.h>. I had to remove the PL/ in my copy of the code since my referenced library didn't use that.

* The rest of the compiler errors were confusion between different ways to access a character in a string using the [] operator. I went with the one using "unsigned int" by changing some counter variables from "int" to "unsigned int".

Here is my fork where I could make it work: https://github.com/GabCM/SortingVisualizer

I've used CLion to assist me in building the CMakeList.txt file and fixing code errors, and I could build it with VS 2019 and MSVC 14 on Windows. In my repo, the required libraries are linked as submodules and the arial.ttf file is supplied. All of the libraries and the font file are linked together in a single CMakeLists.txt. I'm pretty sure you can at least attempt to make the code build with any build method (like g++) and platform.

Your repository doesn't seem to exist anymore.

TheoCGaming avatar Aug 23 '23 14:08 TheoCGaming