I was suggesting to the OP to put everything into a class, that is make the functions member functions.
For the createstack function, I just copied the OP's function - I didn't look at the details of it. That would have been a more complete answer as you have shown. My intention was to show what a member function stub looked like.
The overall purpose of my post was to put forward a more conventional idea on the layout / organisation of files / classes / functions etc. Also I would observe that just because code compiles and runs correctly doesn't mean that it couldn't be organised better.
|I've been shying away from using IDEs because, while they do make things much easier, I'm trying to understand every part of the process.|
That is really good, however I found it was good to use the IDE, so that I could see what the conventional layout of code / files etc. When you understand how it all works, then you do whatever you like. If you do everything from the shell (cmd line) then it is easy to spend a lot
of time trying to figure stuff out. Sure the outcome is great - you now know in detail how it works. I am just saying that using the IDE briefly might be a tool to help figure stuff out more quickly.
Two examples of this are the compiler options, and make files.
The gcc ( g++) complier has a zillion options - sure you only need a few of them, but then I see all the options the IDE uses to compile my project, and I think "How long would it have taken me to figure out that I needed those options."
So then I could go back and look at each option the IDE used, and ask myself what does each one do, and why was it necessary?
Same thing with make files, My IDE produces a make file that is several pages long, just for a fairly simple project. How long would have it taken me to figure that out? I already have a basic understanding of how makefiles work, and if I wanted to, I could analyse the whole thing and learn what it is doing in detail.
|are there any books or online tutorials/guides that you would suggest for a Linux noob?|
they have forums for nearly every sort of linux distro, there is hardware forums, and a programming one as well. If you put C++ in the title of your thread, you will get replies from a bunch of real knowledgeable industry guys. There are real knowledgeable guys here too, but why not get twice the feedback?
|I changed the struct into a class and popped the function defs inside it, but I'm still getting the same errors when I take another go at g++. |
Post your new code, and the compiler output. There are plenty of guys & girls raring to go, to help you out.
As I mentioned earlier, I use KDevelop & QtCreator. KDevelop is supposed to be the most mature & well supported IDE in the Linux world (There all sorts of other ones, which one suits best is up to the individual). It can be used with all sorts of languages & technologies including Qt. Qt is a GUI development system that can cross compile to a number of different OS including Linux, Windows & Mac, and some mobile phones like Android. I use QtCreator IDE for this, because it is an IDE specifically designed for the Qt System.
Hope all goes well, have a great day :)