Common Code::Blocks Set Up Error

I have just installed Code::Blocks 10.05 and I had some difficulties getting source code (like HelloWorld) to compile.
I encountered the following error:

"xxx - Debug" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...
Nothing to be done.

Sure, you can find the solution by searching forums and wading through post after post where idiots (who probably don’t know how to solve the problem since it worked right the first time for them by chance) insult the poor sap who is merely asking for help.
(can you tell that I spent too much time wading through that nonsense?)

Here is what worked for me.

First, remember that Code::Blocks is an IDE—not a compiler. You either have to have a compiler installed, or run the setup files that come with the MinGW compiler. For me, this was: codeblocks-10.05mingw-setup.exe

Second, as the message says, you need to check the toolchain path.
Go to:
1. Click on the Menu Item “Settings”> “Compiler and debugger…”
2. Click on the “Toolchain executables” tab
3. The “Compiler’s installation directory” (marked in blue) is the directory you are interested in.
4. Simply click on “Auto Detect” to the right.
You should now have the compiler set up properly.
Go back to your project and click on build and run.

Now you can actually start programming!

Last, consider those jerks on the forums who think that programming consists of Googling or searching for answers on how to get someone else’s quirky IDE program, compiler, or operating system to do what it is supposed to do and who have nothing better to do than insult people who are having problems. These are the guys who have absolutely no idea what it means to program!
(Before anyone who was insulted by my comments above considers flaming me with further insults, I should tell you that I have failed people like that in my graduate level classes, and your time would be best served by just getting back to work!)

Posted under Programming

This post was written by drknuth on September 22, 2011

Tags: , , , ,

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

This is a note on an error that I have gotten several times when writing php scripts with mySQL.

The error is:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

The offending code snippet essentially looks like this:

$result = mysql_query(“$query_STRING” );
if (mysql_num_rows($result) > 0)
{

which then continues on…

Note that $query_STRING is a string variable that contains the mySQL query.

The problem with this error message is that it is typically due to a problem in the query itself, and there can be many causes.  To catch the cause, change the line that performs the query to:

$result = mysql_query(“$query_STRING” ) or die(mysql_error());

The statement die(mysql_error()) will catch the true error and with luck give you a more meaningful error message.

Posted under Programming, Software

This post was written by drknuth on January 31, 2009

Tags: , , ,