Monday, January 10, 2005

Eclipse and CDT

Currently writing a small command line executable as a helper
tool for my project. Want to use C/C++ for that. Installed
Eclipse, CDT and Mingw. After spending some time on
configuring my system to get the compiler working and Eclipse to
run on the correct JRE/JDK, ... I started to write the code.

Eclipse CDT is a nice environment with syntax highlighting, code
browsing, ect. for developing C/C++ projects. Wanted to test
the "write/save/(re)compile/run the whole application" cycle with
a simple C command line application.
As a Smalltalker I find this development style completely old
fashioned - but it was my own decision to choose C/C++ as the
development language here). So I wrote a simple test program
to see if anything was working:

#include <stdio.h>

int main(void)
{
   printf("Test");
   getchar();
   return 0;
}

If you compile and run the program in Eclipse it shows up in
the console - but I have to hit the ENTER key first and then
I get the "Test" output. So Eclipse is waiting for the key
and then flushed the output to the console. Strange.
If I run the compiled executable on the command line it works
correctly. Question left is: is this behavior intended or a bug?
At least it didnt work in Eclipse as I expected it and this will
always lead to programming errors or confused programmers.
In a Smalltalk IDE I have direct and instant access to the
code to identify the bug but Eclipse/CDT is written in Java and
I was too lazy to download, install and debug the CDT Java
source code...

Lesson learned:
"Dont trust your IDE - always test" and "Return to Smalltalk as
soon as possible!" ;)

No comments: