Original Post
I've long wanted to get away from all of the GUI IDE's and learn some no frills C++ programming. What better way to do so than trudging through development of a very basic text based RPG. Better yet, I want to do this on Linux. If I ever host the server side of this, I'll want the least expensive hosting service I can find, and that means Linux.
Let me tell you why I've tried countless times to do something like this. It's always the same with Linux. It doesn't matter what distro I choose (though I've learned after several hard lessons *not* to start with Gentoo), I always end up scratching my head wondering what freaking masochist came up with this OS. Seriously, I meticulously pick through packages in the package manager, trying to get everything I need to simply compile C++ code with MySQL database access. There are some 50 different packages that all look like they could be necessary! It doesn't matter which ones I choose, however, as I never get all of them I need.
Of course, none of this is made clear to me until I start trying to compile my code. It's at that point I get all kinds of "blahblah() not defined", "cannot instantiate class of type abstract because the seventy-eleven methods listed below are virtual/abstract/something" and other cryptic crap that sends me scurrying to the web trying to find half a clue as to what's going on. This is code straight out of basic code examples found online, not me trying to use libraries with which I'm not familiar.
I copied and pasted the simplest of examples of connecting to a MySQL server and running a select statement - not even against a particular database, but merely one to return a string constant (e.g. SELECT 'hello World" as message). The closest I've gotten it to compile, it reports "unidentified reference to get_driver_instance(). Yeah, I've see all Please check the examples/ directory of your MySQL Connector/C++ installation for complete programs.the suggested fixes, and none work. Some make things worse, creating dozens more compiler errors. Some solutions have said something like "make sure you use -lmysqlclient" - that's it. No explanation as to how to "use" it or even where. I had to dig deeper to find out that it is simply a compiler switch - no idea what it does. Then there are bits of info here and there that suggest I add something to ld.so.conf. What, add it to the end of the file? The first line is "#include such/and/such". Should this new line also start with #include??
I started pouring over the documentation on the MySQL web site. It seems very thorough. However, for example code (yay!) it instructs me: "Please check the examples/ directory of your MySQL Connector/C++ installation for complete programs." Where the hell is that?! I have no idea where it was "installed" (I used quotes there, because I always seem to find references to programs in a dozen different places in a Linux system. Which one would be the installation directory??)
I really want to do this. God knows how many days I've spent trying to get up to speed coding in Linux over the years. It always comes down to stumbling block after stumbling block after stumbling block. I know that there are a few core concepts with which I need to become familiar, and the rest will start clicking. Unfortunately the disjointed environment inherent in open source software has me reeling.
Does anyone have any tips for a Linux n00b on ensuring that my C++/MySQL programming environment is set up correctly? I would ***LOVE*** to find a simple, step-by-step guide, but that's probably expecting too much. I'll settle for solid advice on key points.
I know. I rambled and didn't get very specific with my questions. It's late, and like I said, I'm getting completely frustrated. I don't want to do this in Windows, but does programming on Linux really have to be this freaking complicated?
Thanks for listening.
Let me tell you why I've tried countless times to do something like this. It's always the same with Linux. It doesn't matter what distro I choose (though I've learned after several hard lessons *not* to start with Gentoo), I always end up scratching my head wondering what freaking masochist came up with this OS. Seriously, I meticulously pick through packages in the package manager, trying to get everything I need to simply compile C++ code with MySQL database access. There are some 50 different packages that all look like they could be necessary! It doesn't matter which ones I choose, however, as I never get all of them I need.
Of course, none of this is made clear to me until I start trying to compile my code. It's at that point I get all kinds of "blahblah() not defined", "cannot instantiate class of type abstract because the seventy-eleven methods listed below are virtual/abstract/something" and other cryptic crap that sends me scurrying to the web trying to find half a clue as to what's going on. This is code straight out of basic code examples found online, not me trying to use libraries with which I'm not familiar.
I copied and pasted the simplest of examples of connecting to a MySQL server and running a select statement - not even against a particular database, but merely one to return a string constant (e.g. SELECT 'hello World" as message). The closest I've gotten it to compile, it reports "unidentified reference to get_driver_instance(). Yeah, I've see all Please check the examples/ directory of your MySQL Connector/C++ installation for complete programs.the suggested fixes, and none work. Some make things worse, creating dozens more compiler errors. Some solutions have said something like "make sure you use -lmysqlclient" - that's it. No explanation as to how to "use" it or even where. I had to dig deeper to find out that it is simply a compiler switch - no idea what it does. Then there are bits of info here and there that suggest I add something to ld.so.conf. What, add it to the end of the file? The first line is "#include such/and/such". Should this new line also start with #include??
I started pouring over the documentation on the MySQL web site. It seems very thorough. However, for example code (yay!) it instructs me: "Please check the examples/ directory of your MySQL Connector/C++ installation for complete programs." Where the hell is that?! I have no idea where it was "installed" (I used quotes there, because I always seem to find references to programs in a dozen different places in a Linux system. Which one would be the installation directory??)
I really want to do this. God knows how many days I've spent trying to get up to speed coding in Linux over the years. It always comes down to stumbling block after stumbling block after stumbling block. I know that there are a few core concepts with which I need to become familiar, and the rest will start clicking. Unfortunately the disjointed environment inherent in open source software has me reeling.
Does anyone have any tips for a Linux n00b on ensuring that my C++/MySQL programming environment is set up correctly? I would ***LOVE*** to find a simple, step-by-step guide, but that's probably expecting too much. I'll settle for solid advice on key points.
I know. I rambled and didn't get very specific with my questions. It's late, and like I said, I'm getting completely frustrated. I don't want to do this in Windows, but does programming on Linux really have to be this freaking complicated?
Thanks for listening.