Autodidact Woes

I like learning stuff. Give me a book on the evolution of language, or on textual criticism of the Bible, or on Haydn’s keyboard style, and I can curl up under a lamp and be happy until bedtime. (And retain some of what I read, too.) But right now I’m being utterly defeated by computer science.

I’m a hobbyist programmer. I’ve written several text-based games, so I’m comfortable writing code, compiling it, fixing bugs, and so on. Ten years ago I even taught myself the basics of C++ and the basics of Windows programming, mainly just for fun. I used to know what a bitblt is, and a DIB.

Some recent discussions on have led me to feel that I might like to get more serious about programming, specifically in order to figure out whether I might be able to write a more powerful, more flexible interpreter for running text games (my own and other people’s). I have some pretty specific ideas about what I’d like to see in an interpreter.

Better I should have picked up a brick and smacked myself in the head a few times.

Someone suggested I might want to look at a graphics programming package called Qt. For various reasons, it looks as if it might be exactly what I need. It’s cross-platform, it’s free, and it has an interesting-looking messaging system. So I downloaded it. Well, actually I downloaded it twice. The first time I downloaded a 125MB .zip file that proved to have only the uncompiled raw files (or something). Useless to me. So then I downloaded the 150MB installer program and ran that.

I skipped the opening chapters of the saga, though. Gotta back up a step. Yesterday I installed Xcode on my MacBook Pro. That’s Apple’s development software. Again, it’s free — it comes with your Mac, but it’s on a separate disk, so you install it only if you need it. I installed Xcode 3.0 from the disk and started working the first tutorial. Got about four steps into it, and … oops, the tutorial is two years older than the version of Xcode, and some things have changed, so I couldn’t follow the instructions in the tutorial.

So I downloaded the latest version of Xcode and installed that. Trouble is, there doesn’t seem to be any tutorial at all in the new version. You have to consult tutorials on the Apple website. Well, you see, I like to sit in my easy chair while I do this stuff, and I don’t have a wireless network. I can’t link to the Apple site unless I’m sitting here at my desk with my shoes on.

So okay, I used to know some Windows programming. Maybe I could get back into that. Switch to the PC. Hmm, Microsoft has a free development package called Visual Studio C++ Express Edition 2008. A very nice IDE (and free). If you’re new to programming, I should explain that an IDE is an Integrated Development Environment. It’s pretty. It makes your life easier than if you were doing your programming the old-fashioned way. The old-fashioned way is, after you finish writing your program in a text editor, you type a command at the DOS prompt. Your command line runs the compiler, which turns your code into a program that will run. Okay, that’s the end of the tutorial.

Next I tried running a few bonehead-basic Windows programming tutorials in Visual Studio, just to reacquaint myself with the process. And wouldn’t you know it — none of the tutorials will compile! That’s because the latest version of Visual Studio is Unicode-friendly. The tutorials all assume that characters to be printed out are 8-bit values, and Visual Studio thinks they ought to be 16-bit values.

I consulted a programming newsgroup and some nice person told me how to fix that. But at the same time, someone else told me about Qt. Looks much easier than creating graphics with standard Windows system calls. Okay, let’s try that.

Among the things I’ve now discovered: The free version of Qt doesn’t seem to be compatible with Visual Studio. You have to run it from the command line. Okay, I’ve done that before. Heck, my first computer was a Kaypro, which used CP/M (the precursor of DOS). [Addendum: There’s also a free IDE called Eclipse that may tie all of these components together. We’ll see if I can get that running….] But while Qt comes with rather extensive documentation, the tutorials in the docs just assume that you know a bunch of stuff that I don’t know. Qt installs with a free C++ compiler called MinGW, but the Qt docs say not a freakin’ word about how to invoke MinGW from the command line in such a way as to compile and look at your very first Qt tutorial project. They just assume, “Hey, you know how to run your compiler from the command line. We don’t need to tell you that.”

The Qt tutorial does have instructions on how to create a .pro (project) file and then run a program called qmake. After a few false starts, I managed to do that. The result: a new file in the tutorial examples directory called Makefile. Searching online, I learned that MinGW is invoked from the command line using the command g++. In order to use that command while logged into the directory where my Makefile is, I had to edit the Path variable in my Windows environment, which is something that I’ve never done before, and wouldn’t need to do if the installer were configured better. But by golly, I did it. That’s progress.

But when I type g++ Makefile, MinGW doesn’t know what the hell I’m asking it to do. Evidently I need to use some sort of special syntax, which nobody will tell me. Hey, if they make it easy for just anybody to do this stuff, they’ll lose their social status as experts. (Either that, or the people who write the tutorials are idiots. Take your pick.)

If I could figure out how to run code through the compiler so as to create an executable program that uses one or two basic Qt widgets, the rest of it would be cake. (Hollow laughter.) I’m good at figuring out how to use widgets. But you gotta be able to invoke the compiler, and I can’t do that by hitting F7 in Visual Studio, because Nokia (which owns Qt) wants money for the version that runs in Visual Studio.

I’ve posted plaintive “help” messages in the Qt forum. Gotta go back and check whether anybody has answered yet. I also found an ebook at my local library on Qt, which I can read online. As soon as I get the goddamn thing to compile, I’ll be back on that ebook, you bet. I like learning stuff.

But no, I don’t actually enjoy hitting myself in the head with a brick.

This entry was posted in Interactive Fiction, technology and tagged , , , , . Bookmark the permalink.

2 Responses to Autodidact Woes

  1. kooneiform says:

    For what it’s worth, in any shell/terminal environment usually the Makefile is not passed as an argument to the compiler per se. You might need to just invoke the makefile with ‘make’ at the command prompt, or there could be another utility to use, but you don’t usually do . Think of the Makefile as a Windows .bat file, a set of instructions that executes when the file itself is invoked. I tried to find an example for you:–Dev-Cpp–Windows-problem.html

  2. kooneiform says:

    Sorry, I forgot my angled brackets would get eaten — you don’t usually do ‘compiler’ ‘makefile’ is what I tried to write up there.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s