Category Archives: Programming Languages

compiling windows apps on linux

now that we successfully used cmake to compile a linux app (in the last article), we will now try and compile it for windows.

I am doing this on Gentoo linux, so your mileage may vary if you used a different distribution.

I am starting with http://gentoo-wiki.com/HOWTO_MinGW as a rough guide.

  • # emerge -va sys-devel/crossdev
  • # echo ‘PORTDIR_OVERLAY=”/usr/i686-mingw32/usr/portage /usr/local/portage $PORTDIR_OVERLAY”‘ >> /etc/make.conf
  • create the directory /usr/i686-mingw32/usr/portage
  • install the toolchain: # crossdev i686-mingw32

With Ubuntu/Debian you can simply install it using apt: “apt-get install mingw32”. This will install the toolchain as i586-mingw32msvc-gcc to /usr/bin/ .emerge the packages you want to have as cross compiled programs or libraries.

Once you have installed ming32, it is easy to compile for linux:

#  i686-mingw32-gcc helloworld.cpp -o wintest.exe

Now the next step in the puxxle is to get cmake to compile for both OSes  each time make is run.

Leave a comment

Filed under C++, CDT, cmake, gentoo, linux, windows

Cross platform development with the Eclipse CDT

So, you want to create an application that can un under both Linux and Windows?

This is my experiment trying to do just that… Lets see if the Eclipse CDT is robust to do cross platform development!

Step 1: Install the Eclipse 3.3 SDK if you have not already done so. Make sure to get the CDT components. If you download the java sdk, you can add the CDT packages by adding the following plugin update site: http://download.eclipse.org/tools/cdt/releases/europa

Step 2: Install the cross platform make system, cmake. it’s eclipse download site is:
http://cmakeed.sourceforge.net/updates/

Step 3: Create a C++ project in eclipse.

  • Go to “New->C++ Project” Menu (or Go to “New->Hello World C++ Project” Menu if you are making an empty project and want to see some c++ code used by default)
  • Select the MakeFile Project type, choose Other Toolchain and click Next
  • Select the Advanced Settings Button
  • Uncheck the Use Default Build Command
  • Insert the following in the Build Command Text Field: make -C ${project_loc}/Build VERBOSE=1
  • Under the “C/C++ Build” options, select “Settings”.
  • In the Right Side pane select the binary format for your system (Elf for linux).
  • Click on the OK Button.
  • Create a file in the project root named: CMakeLists.txt [todo: what are the contents of this file???]
  • Open a terminal window
  • cd to your project directory
  • Create a build directory: mkdir Build
  • Change directory to the Build dir: cd Build
  • Run the command: ccmake ../
  • Follow the ccmake instructions. when done, your project is ready.
  • Refresh the eclipse project to show the new build directory.

Step 4: Create an eclipse run menu for cmake:

  • Select the “Run->External Tools->Show External Tools Dialog…” menu.
  • Create a new “Program” and call it Cmake.
  • In the “Location” text field, type the absolute path to cmake (i.e /usr/local/bin/cmake or whatever path your system uses).
  • In the “Working Directory” test field insert the following: “${project_loc}/Build” and in the Arguments section insert the following: “../”.
  • In the “Refresh” tab select The project containing the selected resources.
  • In the “Common” tab check the “External Tools” selection.
  • This will put a shortcut in the “Run” menu for you.
  • Click the Apply Button and then run.
  • CMake will now run on your project directory.

Step 5. Build the project using the command “Run -> External Tools -> cmake”

Next Up: Getting the project to generate both a windows exe and a linux executable.

see also: http://paraview.org/Wiki/CMake:Eclipse

3 Comments

Filed under C++, CDT, cmake, Eclipse, linux, windows

Installing eclipse 3.3 on Gentoo

Today was the day to get eclipse going on Gentoo. I downloaded the latest version (3.3) and dropped it into /opt/eclipse.

I fired it up and got:

# ./eclipse
* run-java-tool is not available for sun-jdk-1.6 on i686
* IMPORTANT: some Java tools are not available on some VMs on some architectures

so, clearly it did not like my java.

I know my java is good:

# java-config -L
The following VMs are available for generation-2:
1) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2]
2) Sun JDK 1.4.2.13 [sun-jdk-1.4]
3) Sun JDK 1.5.0.10 [sun-jdk-1.5]
*) Sun JDK 1.6.0 [sun-jdk-1.6]

Looking around, I found the following:

Java on Gentoo uses /usr/bin/run-java-tool instead of /usr/bin/java (which links to run-java-tool)

the trick is to edit /usr/bin/run-java-tool

after:

tool=$(basename $0)

add

[[ $tool = “run-java-tool” ]] && tool=”java”

then eclipse started perfectly.

5 Comments

Filed under Eclipse, gentoo, Java, linux

first thoughts about eclipse 3.3

After my first full week of using Eclipse (having moved away from JBuilder) I thought I would list some of my thoughts:

  • The visual editor sucks.  Jbuilder 2005/6 and Netbeans have eclipse beat here.  I hope this area improves soon.
  • The spell checker finds spelling mistakes, but right clicking the error does not give an “add to dictionary” option.
  • Eclipse feels much faster than Jbuilder 2005, and eclipse 3.2.
  • It is great to be able to do C++ (CDT) and java in the same IDE.
  • Mylyn (formerly Mylar) rocks.  I am able to interact with tasks while developing, a big time saver.  For example, if there is an error in the ide log, you can right click it and add n eclipse bugzilla defect on the fly.

I still need to get Mantis defect tracking set up with Mylyn.

Leave a comment

Filed under C++, Eclipse, Java

ProjectAssist Installation Errors (part 2)

Having determined the cause of the maven issues, I moved on and cleaned up my system and restarted the install.

I then got perl errors, which the log listed as:

(13:22:49:671) Installing C:\borland\projectassist\Perl\site\lib\Net\LDAP\Extension\WhoAmI.pm
(13:22:49:671) Perl install: processing INSTALL component AppConfig...
(13:22:53:609) Can't call method "ok" on an undefined value at c:/Borland/ProjectAssist/Perl/site/lib/PPM/UI.pm line 881, line 21.
(13:22:53:609) Perl install: ppm command did not succed (exitCode 1):
c:\borland\projectassist\Perl\bin\perl -x -S PPM install c:\borland\projectassist\bugzilla_perl_modules\AppConfig.ppd
(13:22:53:609) Perl install: processing INSTALL component Template-Toolkit...
(13:22:57:218) Can't call method "ok" on an undefined value at c:/Borland/ProjectAssist/Perl/site/lib/PPM/UI.pm line 881, line 17.
(13:22:57:218) Perl install: ppm command did not succed (exitCode 1):
c:\borland\projectassist\Perl\bin\perl -x -S PPM install c:\borland\projectassist\bugzilla_perl_modules\Template-Toolkit.ppd

Continue reading

Leave a comment

Filed under CodeGear, Eclipse, Perl, ProjectAssist

C Programming in Eclipse

In my day to day job, I mainly use java, primarily for the development of graphical interfaces to communicate with custom built hardware running embedded microprocessors (written in assembly and c). In addition though, I also write c and c++ for backend code that needs to run really fast, or needs to do stuff that java has a hard time with.

For example, I am working on a project that uses JNI to integrate a java GUI to a c++ dll, which does some complex data processing for GPS location triangulation. This code is already working in c++ and I don’t want to have top reingineer it in java, as it involves some very ugly math.

I have recently made a switch to eclipse(jbuilder) for java development. Continue reading

1 Comment

Filed under C++, Eclipse, IDEs, Java, Perl, PHP, Programming Languages

Eclipse Multiple Monitor Bug

While Eclipse does work across multiple monitors, I know of one bug that I find quite annoying.

I use 3 monitors, with the main source view occupying my center screen, and the output console occuping the left screen, and all the misc views (outline, problem view etc) taking up the right monitor. Continue reading

Leave a comment

Filed under Eclipse, Programming Languages

JBuilder Registration Woes…

Because of continuing registration issues, I thought it would be interesting to post my thoughts…

The place I work has a poor internet connection (hundreds of employees share a limited isp connection so download bandwidth is limited and large downloads are frowned upon) so I got Codegear (aka Borland) to send me a JBuilder CD.

When I first installed the app, it installed well, but when I went to register, the licensing application responded that the registraion file I was trying was not valid. Continue reading

Leave a comment

Filed under Eclipse, Java, JBuilder

Rambling thoughts about JBuilder 2007…

I recently made the jump to JBuilder 2007. As a long time user of JBuilder (I started using JBuilder back with version 3) I have to start off saying that this version is quite a bit different from any other JBuilder. If you are an Eclipse user you will be quite comfortable with v2007, otherwise there is a hefty learning curve.

At the moment, I am actually having trouble with the registration process, so I have not yet tried out the borland specific features, I am just getting familiar with the Eclipse 3.2 functionality.

One thing I noticed right away is that I find the UI designer a big letdown from the old JBuilder.

I will post more here in a bit when I get further along in the process.

2 Comments

Filed under Eclipse, Java, JBuilder