Approximately one year ago I herniated a disk in my spine. It's been a long roller coaster, but I am finally starting to be able to do normal-people-things beyond sitting and laying down. Now that I feel like my back is more or less stable and isn't going to change preference any time soon, I decided it is time to get a "real" chair to work in - as I spend almost my entire work day sitting in front of a computer.
I have heard many great things about Herman Miller Aeron Chairs, as well as their Mirra Chair, so I had to try them out. I thought about getting one via Craigslist, as it is pretty easy to get 50% or mroe off the sticker price, but I came to the conclusion that was not the right solution for me. I didn't want to try out one of these chairs for the first time in someone's house, sitting in it for 30 minutes to make sure I like it, while trying to make awkward small talk with the seller as they eagerly wait for me to give them money and leave. Also, these chairs come with a 12 year manufacturer warranty, and I figure it is worth paying more for that - that's a REAL warranty.
I set off to the local Design Within Reach store to try them out. It took two trips for me to decide weather I wanted one, and which one to get. Here are my initial impressions in the store:
Mirra Chair
The Mirra Chair really looks cool to me, based purely on color. It also feels pretty good too. I find the lumbar adjustments on it to be superior to the Aeron's, but I only tried the Aeron's optional "Lumbar", not the "PostureFit". That said, the chair does have its flaws.
First of all the hard-plastic back, and the mesh seat, feel terrible if you are wearing anything that has a wrinkle, a fold, a seam, or in the case of my girlfriend - a bra strap. It pushes these things into you because it is a hard flat surface. I began to wonder if I would constantly be trying to pull out the slack in my sweatshirt so it wouldn't create annoying wrinkle bends pressing into my back.
Secondly, when you lean forward and hit the end of the range of travel, it really just stops with a clank. I need to reach onto my desk to play with circuits and this and that, and I would find this very annoying. I think there is an option for forward tilt that this floor model didn't have - not sure here.
That said, the backrest does have some benefits. As I mentioned before, the lumbar adjustment is nice, but I found myself constantly adjusting it. That may or may not be a problem. Also, I found it kind of nice to bounce back and forth in the chair (with my shoulders, more or less). However, it put me in a very upright position when sitting still, and I like to always be leaned back a medium amount on my shoulders. Being too upright will usually cause me to hunch forward. This might be possible to adjust out, I am not sure.
It is definitely worth trying. With some adjustment it could be right for you. I personally didn't rule it out until I pulled it up to a desk with a keyboard and started typing, at which point the high sitting angle just didn't feel right and that kind of led me to the Aeron.
Aeron Chair
The Aeron Chair is the old classic, instantly recognizable, everyone drools over chair. I am not one for cliche, so I had my doubts. I will say that it is a very good chair. The most interesting thing about it is how it moves back and forth when you lean your weight around. You can unlock the front and rear tilt, and it feels like you are riding almost like on one of those kid's rocking horses that are suspended on 4 trampoline. The seat platform and back rest both move in a fluid motion.
When I first sat in it, it was horribly rigid. As I said before, I like to lean back. I way 140 ish pounds, so I really had to loosen up the back rest - and on this chair it takes approximately 20 turns to really get a lot of progress on that. But once I did, the position and tension of the chair felt GOOD.
The one reason I don't like it is the lumbar support only feels good to me when it is pushed all the way to the lowest location. You can slide it to several places up and down, and you can flip it over to get two different "depth" settings. Generally speaking I found that if I move it out of the lowest position it feels like I am leaning against a baseball. This has me very weary. I might try out a "Posturefit" instead of the older "Lumbar" support. Generally speaking I think the lumbar adjustment is junky. However that one position I did find - all the way down - feels pretty good and supportive. I hope I will always be fine with that setting.
The seat pan is very similar to the Mirra Chair in construction. This one also has a little bit of that "hard" feeling, where you can feel every seam of your underwear. I am a particularly bony guy, so it might be different for you. The back rest, though, is a lot better in terms of softness.
Last, I found the position of the adjustable arm-rests on the Aeron to be superior. I like to have my elbows in. I twist the armrest to be pointing inward at my knees as far as possible, and rests my elbow areas on the armrests while typing. The Mirra wasn't bad, but the Aeron definitely felt better for my personal tastes.
Conclusion:
Everybody is different, so I recommend you actually try the chairs out. Sit in them for 30 minutes. Be sure to really play with the adjustments - these chairs feel terrible if they aren't adjusted to you.
Both chairs are good. It took a lot of time for me to decide - two trips to the store, over an hour long each.
If I had to tell you which to buy and you couldn't try first, I would go with the Aeron. There seems to be a lot of resounding agreement that it is a good chair. I myself agree.
I purchased the Aeron, and I am waiting for it in the mail. I will probably make a followup to this after I have sat in it for a few days, but that will just be on the Aeron - which you can read about anywhere. I really wanted to write something focusing on the differences between the two chairs, and this is as far as I can go.
IrkedRants
In the world of computing, I notice a lot of annoying problems. Here I call them out, and sometimes I post my findings. If you have something to add, please leave a comment!
Sunday, June 12, 2011
Wednesday, March 23, 2011
Compiling GTKGlExt in Windows using MinGW
I spent two weeks of free time trying to figure out how to compile GTKGlExt in Windows. It's no easy task. GTKGlExt is old. It hasn't been updated in a long time, from what I can tell. It's instructions are even older - there are some new issues that the instructions do not adress.
First of all - I had a lot better luck using MinGW through MSYS than I did with cygwin. Cygwin tends to chock on windows \r characters, which seem to crop up through the pkg-config utility and then spread like a sick disease. There also may be conflicts between it and the MinGW toolchain. You can read about some of these issues here.
The general gist of things is that you should install MinGW with MSYS, then follow the instructions in the GTKGlExt zip file, but you need to remove some references to pangox. More complete instructions follow:
1) Download MinGW. It can be had from http://www.mingw.org/. When you start installing it, be sure to check the box for MSYS. Also, I recommend installing it to the default location - C:/MinGW/
2) Install GTK+. I personally use the bundle, available from http://www.gtk.org/download-windows.html I download the All-in-one bundle, version 2.22. I unzip the contents to C:/gtk+bundle/ Do NOT use a directory with spaces in it, as this will screw up the pkg-config utility.
3) Download GTKGlExt. I specifically downloaded the 1.2.0 Release from 2006. Open up the archive, if you do not have a program that will handle this file, 7-Zip is free and it should work. I recommend decompressing the files to C:/gtkglext/ . The docs folder should then be C:/gtkglext/docs. It should NOT be C:/gtkglext/gtkglext-1.2.0/docs. Do NOT use a directory with spaces in it, as this will screw up the pkg-config utility.
4) Open C:/gtkglext/configure in a text editor. And remove all references to pangox.
Delete lines like these:
5) Various files have old deprecated macros in them. These replacement functions were found in the GtkWidget documentation page in the GTK+ Reference Manual.
Macro GTK_WIDGET_REALISED needs to be replaced with function gtk_widget_get_realized. The parameters are the same. Do this at:
7) Open up MinGW Shell from the Start menu. This will give you a linux-like bash shell for you to enter commands. It is very helpful to understand how to use bash when doing these sorts of things.
Some things to note:
At this point you should have the libraries and DLLs built. The next logical step is to build the examples.
9) This step is needed because pkg-config likes to leave carriage return characters in its output. Open up the file c:/gtkglext/examples/Makefile.mingw and pipe the pkg-config output through the command tr -d "\r" in lines 9 through 11. They should look like this (I apologize that blogger is wrapping the lines, disregard that):
before:
I plan to follow up soon with an explanation of how to setup a project in Eclipse that includes everything you need to use GTKGlExt. At that point you can easily experiment with some code of your own! Check back later!
First of all - I had a lot better luck using MinGW through MSYS than I did with cygwin. Cygwin tends to chock on windows \r characters, which seem to crop up through the pkg-config utility and then spread like a sick disease. There also may be conflicts between it and the MinGW toolchain. You can read about some of these issues here.
The general gist of things is that you should install MinGW with MSYS, then follow the instructions in the GTKGlExt zip file, but you need to remove some references to pangox. More complete instructions follow:
1) Download MinGW. It can be had from http://www.mingw.org/. When you start installing it, be sure to check the box for MSYS. Also, I recommend installing it to the default location - C:/MinGW/
2) Install GTK+. I personally use the bundle, available from http://www.gtk.org/download-windows.html I download the All-in-one bundle, version 2.22. I unzip the contents to C:/gtk+bundle/ Do NOT use a directory with spaces in it, as this will screw up the pkg-config utility.
3) Download GTKGlExt. I specifically downloaded the 1.2.0 Release from 2006. Open up the archive, if you do not have a program that will handle this file, 7-Zip is free and it should work. I recommend decompressing the files to C:/gtkglext/ . The docs folder should then be C:/gtkglext/docs. It should NOT be C:/gtkglext/gtkglext-1.2.0/docs. Do NOT use a directory with spaces in it, as this will screw up the pkg-config utility.
4) Open C:/gtkglext/configure in a text editor. And remove all references to pangox.
Delete lines like these:
pangox >= 1.0.0 \\And remove the pangox from inside this line:
GDKGLEXT_PACKAGES="gdk-2.0 pango pangox gmodule-2.0"This step may break compatibility with linux, but, you should probably have a separate copy for that anyway. Maybe someone out there who is more experienced than I can fix this issue so we don't have to do this? You can read more about that here.
5) Various files have old deprecated macros in them. These replacement functions were found in the GtkWidget documentation page in the GTK+ Reference Manual.
Macro GTK_WIDGET_REALISED needs to be replaced with function gtk_widget_get_realized. The parameters are the same. Do this at:
- c:\gtkglext\gtk\gtkglwidget.c - lines 130, 157, 177, 197, 254, 435, 477, 504
Macro GTK_WIDGET_TOPLEVEL needs to be replaced with function gtk_widget_is_toplevel . The parameters are the same. Do this at:
- c:\gtkglext\gtk\gtkglwidget.c - line 177
Macro GTK_WIDGET_NO_WINDOW needs to be replaced with function !gtk_widget_get_has_window. The parameters are the same. Note the logical "NOT" operator, the new function has the opposite behavior as the old macro. Do this at:
- c:\gtkglext\gtk\gtkglwidget.c - line 253 - Note that adding a NOT operator to this line would yield, 2 NOTs, so you can just remove the existing NOT instead of adding one.
7) Open up MinGW Shell from the Start menu. This will give you a linux-like bash shell for you to enter commands. It is very helpful to understand how to use bash when doing these sorts of things.
Some things to note:
- To get to your C: drive you would go to the directory /c/ by entering:
cd /c/
- Symbolic links don't exist in MSYS. If you try to make one, it actually makes a copy of the directory. This can lead to confusion later.
cd /c/gtkglextJust as a note, if you do as recommended in the README.win32 file and enable the --enable-debug=yes option, this will create errors. I have a post about this here.
export PATH=/c/gtk+bundle/bin:$PATH
export PKG_CONFIG_PATH="c:/gtk+bundle/lib/pkgconfig"
export PATH=/c/MinGW/bin:$PATH
env CC='gcc -march=pentium' \
./configure --prefix=c:/gtkglext \
--build=i386-pc-mingw32 \
--disable-static
make
make install
At this point you should have the libraries and DLLs built. The next logical step is to build the examples.
9) This step is needed because pkg-config likes to leave carriage return characters in its output. Open up the file c:/gtkglext/examples/Makefile.mingw and pipe the pkg-config output through the command tr -d "\r" in lines 9 through 11. They should look like this (I apologize that blogger is wrapping the lines, disregard that):
before:
INCLUDES := $(shell pkg-config --cflags gtkglext-1.0 pangoft2)after:
LIBS := $(shell pkg-config --libs gtkglext-1.0)
LIBS_WITH_PANGOFT2 := $(shell pkg-config --libs gtkglext-1.0 pangoft2)
INCLUDES := $(shell pkg-config --cflags gtkglext-1.0 pangoft2 | tr -d "\r")10) Now at the MSYS prompt, type the following lines (be sure that you have have the previous PATH and PKG_CONFIG_PATH commands from before):
LIBS := $(shell pkg-config --libs gtkglext-1.0 | tr -d "\r")
LIBS_WITH_PANGOFT2 := $(shell pkg-config --libs gtkglext-1.0 pangoft2 | tr -d "\r")
$ cd /c/gtkglext/examples11) Run an example program, my favorite is shapes.exe:
$ make -f Makefile.mingw
$ shapes.exeAt this point you have a running program. If you close MSYS and you want to run the programs in the future, you will need the DLLs. One simple way to do this is to copy the exe file you want to run to a new folder, and copy the DLLs from c:/gtk+bundle/bin and c:/gtkglext/bin into the same folder with the exe. At that point you can run it any time you want.
I plan to follow up soon with an explanation of how to setup a project in Eclipse that includes everything you need to use GTKGlExt. At that point you can easily experiment with some code of your own! Check back later!
STMicro's STMPE16M31 - A classic example of cumbersome power supply and signal level design.
STMicro's STMPE16M31 is a touch sensor IC that is designed to operate from one external power supply between 2.7 and 5.5V. Great, right? Well the dirty little secret on this thing is that its interface signals are scaled at 1.8V.
Why not buffer these signals internally to match the input supply voltage of 2.7 to 5.5V? That would make a lot more sense to me, considering I have this supply voltage available, which means I probably use it as a signal level. Instead, they assume I have 1.8V signaling capabilities available. If I had that, then I would probably have a 1.8V voltage supply I could power the device from - and it would be significantly more efficient than their internal regulator. Also, the rail inside the IC is probably at a different voltage than the 1.8V level I use outside the device, which means my signal level will be slightly different as well - probably not an issue looking at the spec sheet, but it doesn't make me feel any better about the design.
The part seems to work great, but I hate the complexity of making a design around it.
Why not buffer these signals internally to match the input supply voltage of 2.7 to 5.5V? That would make a lot more sense to me, considering I have this supply voltage available, which means I probably use it as a signal level. Instead, they assume I have 1.8V signaling capabilities available. If I had that, then I would probably have a 1.8V voltage supply I could power the device from - and it would be significantly more efficient than their internal regulator. Also, the rail inside the IC is probably at a different voltage than the 1.8V level I use outside the device, which means my signal level will be slightly different as well - probably not an issue looking at the spec sheet, but it doesn't make me feel any better about the design.
The part seems to work great, but I hate the complexity of making a design around it.
Tuesday, March 22, 2011
A GTKGlExt Compile Issue: error: dereferencing pointer to incomplete type
If you see this while running make on GTKGlExt:
To fix it, run the ./configure command as before without the --enable-debug option, then try make again. I hope that works for you.
Maybe someone out there can get the root cause of this fixed one day? *hint hint*
gdkglwindow.c: In function 'gdk_window_set_gl_capability':it might be because you ran configure with the "--enable-debug=yes" option. If this option is absent, it will use the default minimum setting, which is safer than the no setting. Doing this will change some defines related to depreciation that appear to be killing the build at this point - I am guessing this issue emerged as GTK changed since GTKGlExt was released in 2006.
gdkglwindow.c:743:3: error: dereferencing pointer to incomplete type
gdkglwindow.c:749:3: error: dereferencing pointer to incomplete type
To fix it, run the ./configure command as before without the --enable-debug option, then try make again. I hope that works for you.
Maybe someone out there can get the root cause of this fixed one day? *hint hint*
Monday, March 21, 2011
Microsoft Excel: Yet another bug.
I tried importing a terribly formatted LTSpice output file into Excel today, only to find that when you use fixed column widths, using their handy little tool that lets you put verticle lines between text - that those lines don't actually mean anything. As you scroll left and right in the view, the lines jump around left to right, and end up somewhere you don't want them.
How long has Microsoft been making Excel? It still has stupid problems like these, in simple features? And you want me to buy a new version, when you can't even get the old version right? I can only imagine what bugs were added when they switched to that awful new user interface.
Side note: it looks like LibreOffice seems to work. Progress continues...
How long has Microsoft been making Excel? It still has stupid problems like these, in simple features? And you want me to buy a new version, when you can't even get the old version right? I can only imagine what bugs were added when they switched to that awful new user interface.
Side note: it looks like LibreOffice seems to work. Progress continues...
Saturday, March 12, 2011
GtkGLExt - No love for windows.
I have this running theory: if open source were easy, every one would use it. I try and use this blog to help with this, and complain when I can't.
This is a work in progress acting as my scratchpad while I work through the issues. I plan to clean this post up once I am finished.
I am trying to get GtkGLExt working in windows. Definately not something you would want to do if you don't have experience linux / bash / shell scripting / configure scripts / etc.
First, it seems pretty mandatory that you install cygwin. Also note, by default, it will not put in all the packages you need. You are going to need to install some extras. For instance, you will need the package with "ar" in it.
Then you are going to need to figure out how to get to your various places in the file system. Hint: the "/cygdrive/" fake directory takes you to the root of your file system, so "C:/" is at "/cygdrive/c/"
Second, straight out of the box gcc (MinGW) is going to crash. You must run export TEMP="/tmp/" to get the crash to go away. What a weird crash - no error message or anything.
Then you are going to need to address this problem:
http://mail.gnome.org/archives/gtkglext-list/2006-November/msg00003.html
I dealt with it by removing all references to pangox in the configure file.
Then I came upon this problem, elaborated in config.log:
Sometimes on multiple attempts at make I get this:
Another problem I got was this:
This is a work in progress acting as my scratchpad while I work through the issues. I plan to clean this post up once I am finished.
I am trying to get GtkGLExt working in windows. Definately not something you would want to do if you don't have experience linux / bash / shell scripting / configure scripts / etc.
First, it seems pretty mandatory that you install cygwin. Also note, by default, it will not put in all the packages you need. You are going to need to install some extras. For instance, you will need the package with "ar" in it.
Then you are going to need to figure out how to get to your various places in the file system. Hint: the "/cygdrive/" fake directory takes you to the root of your file system, so "C:/" is at "/cygdrive/c/"
Second, straight out of the box gcc (MinGW) is going to crash. You must run export TEMP="/tmp/" to get the crash to go away. What a weird crash - no error message or anything.
Then you are going to need to address this problem:
http://mail.gnome.org/archives/gtkglext-list/2006-November/msg00003.html
I dealt with it by removing all references to pangox in the configure file.
Then I came upon this problem, elaborated in config.log:
configure:20297: gcc -march=pentium -o conftest.exe -g -O2 -Wall -g -mms-bitfields -mms-bitfields -IC:/gtk+bundle/include/glib-2.0 -IC:/gtk+bundle/lib/glib-2.0/includeThis problem is due to some '\r' characters getting picked up in the C include paths and the libs path (I presume they come from pkg-config running in windows). I had to strip them - more on that whenever I update this page.
conftest.c -LC:/gtk+bundle/lib -lglib-2.0 -lintl
>&5
gcc.exe: : Invalid argument
gcc.exe: : Invalid argument
Sometimes on multiple attempts at make I get this:
.deps/gdkglenumtypes.Plo:1: *** multiple target patterns. Stop.The solution to that is to overwrite the relevant .deps folder with the on out of the original zip file. These files contain dummy text that will then get overwritten again by make. I am not sure why this occurs in the first place.
Another problem I got was this:
/bin/sh: line 1: glib-mkenums: command not foundThis is a perl script that needs to be run. It comes with GTK+. I am using the GTK+ All-in-one bundle for Windows, installed at C:/gtk+bundle so I needed to include C:/gtk+bundle/bin in my PATH. You might also get this if you don't have the perl package installed in your cygwin?
Monday, February 21, 2011
Configuring Eclipse to Compile a GTK+ Project Written in C, on a Windows Platform.
There are plenty of websites detailing how to get started with GTK+ programming. This page aims to fill a gap: how to setup the Eclipse environment operating in Windows XP. This can be a frustrating task for someone who isn't very familiar with pkg-config and gcc command line switches. Assuming you understand the basics of header files, libraries, and the Windows command line, this page should tell you what you need to know.
Background
When setting up a GTK+ based C project, there are a lot of headers and libraries that must be included. This creates several issues in Eclipse, and even more when programming in a Windows environment. The standard solution (which does not work for us) is to use the pkg-config utility to provide this info on the fly, as demonstrated below:
This is taken straight out of the GTK+ 2.0 Tutorial - Compiling Hello World . It is a perfect solution for command line based development using a Linux style shell. This will NOT work with Windows. Trying it will produce output like this:gcc -Wall -g helloworld.c -o helloworld `pkg-config --cflags gtk+-2.0` \
`pkg-config --libs gtk+-2.0`
cc1.exe: error: unrecognized command line option "-fcflags"The pkg-config utility is placed in back-ticks (usually above the tab key, on the same key as the "~" character), which tells the shell to run the command between the backticks first, and place the output in that place. Running the pkg-config utility with the gtk+-2.0 package will output all the options and switches that gcc needs to add in the GTK+ libraries - specifically the header file paths, the libraries, and some other gcc switches. Windows does not do this.
cc1.exe: error: unrecognized command line option "-flibs"
The key is to figure out what information pkg-config is trying to pass to gcc, and manually enter it in to Eclipse. This process is long and it will take a while. When you do it correctly, you get the added benefit of Eclipse knowing where all the header files are, which will allow the IDE to use all of those features that make IDEs so nice to work with.
How-To
1) Download Eclipse IDE for C/C++ Developers. I am using the "Helios" release, which is the latest version as of this posting. Every new version they increment the first letter of the name, so the next release will start with "I". To guarantee compatibility with these instructions, stick to "Helios". Unzip the folder wherever you want the program to reside. It does not use an installer, it just sits in the folder and runs from there (NICE!)
2) Download the GTK+ Development Package. Get the "All-in-one Bundle", version 2.22. Unzip the folder wherever you would like to keep the files.
2) Download the GTK+ Development Package. Get the "All-in-one Bundle", version 2.22. Unzip the folder wherever you would like to keep the files.
3) In Eclipse create a new "Hello World" project using the C language. Verify that it runs, etc.
4) Copy and paste the Hello World in GTK+ example from the tutorial into your main.c file. Note that it will NOT compile, and it cannot find the gtk/gtk.h file. Eclipse will highlight the #include line and complain of an "Unresolved Inclusion".
5) We need to add all the information for the header file locations, as well as some other gcc flags that are provided by the pkg-config utility, for the "cflags" option and enter it into your Eclipse project. I warn you, this will not work right if there any spaces in the directory names in the path to your GTK+ bundle files. I advise that you at least make a temporary copy of the bundle to C:\gtk+bundle\ to get the output from pkg-config.
Open a command prompt (Start->Run, "cmd"), navigate to your GTK+ bundle directory, to the "bin" subfolder. Run the following command:
pkg-config --cflags gtk+-2.0 > _temp.txtThis will run the pkg-config utility, specifying the gtk+-2.0 package, with the --cflags option. The output will be piped into a file called _temp.txt.
Now you can open up the file _temp.txt in that directory to see the output. Mine looks something like this:
-mms-bitfields -IC:/gtk+bundle/include/gtk-2.0 -IC:/gtk+bundle/lib/gtk-2.0/include -IC:/gtk+bundle/include/atk-1.0 -IC:/gtk+bundle/include/cairo -IC:/gtk+bundle/include/gdk-pixbuf-2.0 -IC:/gtk+bundle/include/pango-1.0 -IC:/gtk+bundle/include/glib-2.0 -IC:/gtk+bundle/lib/glib-2.0/include -IC:/gtk+bundle/include -IC:/gtk+bundle/include/freetype2 -IC:/gtk+bundle/include/libpng14Again, these are all flags that are intended to get passed to gcc when you compile. If all you want is to compile from the command line, you could probably put this string into an environment variable and use that environment variable in place of the pkg-config call.
I generally start by rearranging this output in notepad so that it is more readable, giving each option its own line:
-mms-bitfieldsHere there are two types of things being specified: compiler options (-mms-bitfields) and header include file paths (-I). These need to get entered into Eclipse. Here is how you add them to the C project. Note: This change is only for the open project, if you make a new project you will have to do this again.
-IC:/gtk+bundle/include/gtk-2.0
-IC:/gtk+bundle/lib/gtk-2.0/include
-IC:/gtk+bundle/include/atk-1.0
-IC:/gtk+bundle/include/cairo
-IC:/gtk+bundle/include/gdk-pixbuf-2.0
-IC:/gtk+bundle/include/pango-1.0
-IC:/gtk+bundle/include/glib-2.0
-IC:/gtk+bundle/lib/glib-2.0/include
-IC:/gtk+bundle/include
-IC:/gtk+bundle/include/freetype2
-IC:/gtk+bundle/include/libpng14
First you need to right click your project in the Eclipse Project Explorer pane, which is the tree that is usually on the left of the screen. Click Properties to bring up Properties of your project. Navigate the tree on the left to C/C++ Build/Settings and then on the Tool Settings tab go to the GCC C Compiler item in the tree:
Place the various option we got from pkg-config between "${COMMANDS}" and "${FLAGS}" in the "command line pattern" box. In this case it is the "-mms-bitfields" option.
Now we need to add the include files. I like to use path name variables to simplify the process if I decide to move things around later. The way I chose to do this was to create a path name variable called GTK_BUNDLE_PATH. This path variable can be used in place of the directory string, and if I want to move the bundle, I only have to change this one variable instead of all the include paths. To set this up, in the Project Properties window navigate in the tree to C/C++ Build->Build Variables, and click "Add..." on the right side:
Fill it in as shown, with the Variable Name set to GTK_BUNDLE_DIR, type as PATH, and Value as the directory, in this case C:\gtk+bundle\. "Apply to all configurations" will do this to both the "Debug" and "Release" build configurations:
Now that the path variable is established, let's take our reformatted pkg-config output from before, remove the options that we already entered ("-mms-bitfields" in my case), remove the -I include flag prefixes, and replace the package directory with a reference to the path variable, where we use ${GTK_BUNDLE_PATH} to signify that we want the value of GTK_BUNDLE_PATH placed there. Also put quotes around each line:
"${GTK_BUNDLE_PATH}/include/gtk-2.0"Be careful! Only replace "C:\gtk+bundle" with ${GTK_BUNDLE_PATH} no more, no less!
"${GTK_BUNDLE_PATH}/lib/gtk-2.0/include"
"${GTK_BUNDLE_PATH}/include/atk-1.0"
"${GTK_BUNDLE_PATH}/include/cairo"
"${GTK_BUNDLE_PATH}/include/gdk-pixbuf-2.0"
"${GTK_BUNDLE_PATH}/include/pango-1.0"
"${GTK_BUNDLE_PATH}/include/glib-2.0"
"${GTK_BUNDLE_PATH}/lib/glib-2.0/include"
"${GTK_BUNDLE_PATH}/include"
"${GTK_BUNDLE_PATH}/include/freetype2"
"${GTK_BUNDLE_PATH}/include/libpng14"
Now that you have the include directories all preformatted, you can enter them into the project. In the Project Properties window, you can navigate the tree to C/C++ Builds->Settings, in the Tool Settings tab navigate the tree to GCC C Compiler->Includes. The top list on the right is the "Include Paths (-I)". Add each line from our list above as a seperate item to this list, using copy-paste, one at a time:
That should cover all the c flags, and should get your #include issues to go away. Now the library files need to be added.
6) Next we need to add the library settings to the project. Again we get these from pkg-config, with the --libs option:
pkg-config --libs gtk+-2.0 > _temp2.txtThe output (in the text file _temp2.txt) should be something like this:
-LC:/gtk+bundle/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintlAgain let's clean up the formatting in notepad, giving each item it's own line:
-LC:/gtk+bundle/libYou need to know that -L specifies the path to look for libraries, and -l (lowercase L) specifies the name of a library. I do a pre-cleanup of the list by getting rid of the option switches, and replacing the bundle path with the path variable we setup previously:
-lgtk-win32-2.0
-lgdk-win32-2.0
-latk-1.0
-lgio-2.0
-lpangowin32-1.0
-lgdi32
-lpangocairo-1.0
-lgdk_pixbuf-2.0
-lpango-1.0
-lcairo
-lgobject-2.0
-lgmodule-2.0
-lgthread-2.0
-lglib-2.0
-lintl
Paths:
${GTK_BUNDLE_PATH}/lib
Libraries:
gtk-win32-2.0
gdk-win32-2.0
atk-1.0
gio-2.0
pangowin32-1.0
gdi32
pangocairo-1.0
gdk_pixbuf-2.0
pango-1.0
cairo
gobject-2.0
gmodule-2.0
gthread-2.0
glib-2.0
intl
(Side note: the -l option actually specifies to look for a library with the name that follows it, preceded with "lib" and ending with ".a" , so "-lfoo" ACTUALLY means a file called "libfoo.a". Luckily you can ignore this for Eclipse purposes because it wants the text in exactly the same format as the -l option specifies).
Navigate the Eclipse Project Properties window to C/C++ Build->Settings, and on the Tool Settings tab navigate the tree to MinGW C Linker -> Libraries. Here I add the libraries and the path, line by line, into the respective lists:
6) Say a prayer, and attempt to build. If you get a bunch of errors, I am sorry. Hopefully you can troubleshoot it.
Maybe someone out there who is experienced with eclipse can create some kind of utility to speed up the process? If you know of any easier way, please let me know!
Subscribe to:
Posts (Atom)