Archive for March, 2008

Qt 4 + CMake + Visual Studio rules now

Thanks to Bill from Kitware Inc., who responded my previous post in a very timely manner and helped me solve the compilation issues as well as the execution error.  CMake and Visual Studio 2008 are now back in the triangle.

The compilation problem lies the source code of the Qt demo. Two other classes were declared in two of the class definition .cpp files so that either moc’ing the sources or moc’ing the headers will leave some of Q_OBJECT classes un-moc’ed, which causes the linking errors. On the other hand, qmake handles this implicitly so the project file it generates doesn’t have this problem. After moving those declarations to the header files, everything compiled nicely and quietly.

As for the debug execution problem, Bill also suggested that the commercial evaluation version of Qt 4 binary I downloaded might be built with VS 2005. If that is the case, there is no way I can execute in debug mode the program linked against the Qt 4 libraries. I was just being so naive to make the assumption that the binaries should be of no difference if QMAKESPEC is the same.

After downloading and compiling the source of Qt 4.4 beta (boy, that compilation DID take QUITE a while), everything went back to normal. I am now happily “CMaking” my projects again.

Qt 4.3.4 + CMake + Visual Studio 2008 doesn’t work

Hoping to create a nice GUI for the project I am currently working on, I downloaded the commercial version of Qt 4.3.4. It installed fine, with the option of integrating with Visual Studio disabled since the integration with VS 2008 is not officially supported yet. Trolltech has already announced to support this in the upcoming version of 4.4, though.

The demo that comes with the package looks really appealing, just like how I like it: simple, themed design and fluent animated transition, which together provide the user with maximum visual satisfaction.

Trolltech is generous enough to have included all the source code of the demo so that we can play around and figure out how to mimic those fancy effects. At first I planned to use CMake to generate the project file (.sln file in the case of Visual Studio) for the demo, in accordance with all other projects that I am working on. There are also examples of CMakeLists.txt for Qt 4 projects (here is one). Despite it seemed that everything should be easily done without any hustle, it soon turned out not to be the case this time.

First, the solution file generated by CMake just won’t compile (unless it’s a single main.cpp, in which case I got it to work) if there are other Q_OBJECT classes present. I tried both QT4_AUTOMOC and QT4_WRAP_CPP, all ended up with “error LNK2019: unresolved external symbol“:

SET(SRCS src/main.cpp src/mainwindow.cpp)
SET(HDRS include/mainwindow.h)

and either




Correct me if I am doing anything wrong above. After googling a bit I figured that something is wrong with the moc’ing process, but I haven’t yet found a solution. Thus I am taking CMake out of the equation temporarily.

A nice thing about qmake that comes with the Qt package is that just like CMake it can generate project files for different platforms, with an equivalent of CMakeLists.txt, file. With the command

qmake -tp vc -spec win32-msvc2005

one can easily get the project file (.vcproj/.sln) for Visual Studio 2005 to use. The project compiled under VS 2008 without any error, but when running under debug mode I get either “This application has failed to start because the application configuration is incorrect” if the solution file is generated by qmake or “The application failed to initialize properly (0xc0150002)” if it is created by CMake (remember I had one single main.cpp compiled). However, the release builds executed correctly.

Again I googled for a while and found out the problem might lie in the manifest files of the Qt core dll’s. Since the QMAKESPEC is set to win32-msvc2005, the manifest files of the dll’s have VS 2005 info (Microsoft.VC80.DebugCRT) embedded. When the program compiled with VS 2008 (VC90) and linked against those dll’s tries execute, there’s a conflict in configuration. Unfortunately, none of the solutions I found worked.

Now it is quite clear that for now I cannot (at least easily) debug the Qt4 programs in VS 2008. VS 2005, on the other hand, is working as advertised both in debug and release mode. Guess I would have to stick with VS 2005 for a while before Qt 4.4 is released.

An alternative plan would be trying out the 4.4 beta to see if it is a solution, while using qmake to generate the Makefile, from which to see how the CMakeLists.txt should be written.

New Google Calender feature: sync with Microsoft Outlook

Just now when I was creating an event in my Google Calender (GCal) I happened to notice that Google is offering a synchronization service between GCal and MS Outlook.

Aside from this topic itself, I would have to say that Google does have some unique style of “announcing” new features. I don’t know about the situation of technology-savvy people who subscribe to Google’s announcement, but for me I don’t hear rumors, I don’t see official news, I don’t receive email notifications – the advent of a new feature is displayed merely in bold red font in the top toolbar of Google sites, and believe me there is a pretty good chance that it would be overlooked. So it is highly likely to lead to “Hmm, since when did Google begin to have this?” when you are just performing your regular routines with any Google service.

Now back to the new feature GCal offers: 2-way syncing with Microsoft Outlook. Isn’t that great? Previously we were only able to subscribe the GCal’s (assuming multiple calenders serving difference purposes) in Outlook to view them. Event editing had to be done on the server side, but now you can create and edit whichever side you want. On top of that, it is a free service.

That suddenly reminded me that I paid $65 for Spanning Sync for my Mac, which essentially (and only) performs 2-way syncing between GCal and iCal. It is simple but it does its job very well and the customer service has been very responsive. Yet truth to be told, I think $65 is a little bit too expensive for this feature. There is also a subscription option available for $25 a year, but I am just no subscription guy (part of the reason I didn’t buy .mac).

Anyway, since Google released Outlook syncing service. It could indicate that a free iCal syncing service is also in the future plan, which means I might have wasted my bucks.

Not so fast. I downloaded and installed Google Calendar Sync as instructed, but found that only my primary calender in GCal got its way to Outlook. Not surprisingly, I found this when I checked again the Getting Started page:

Keep in mind that it’s not possible to sync events on secondary calendars at this time. Google Calendar Sync will only sync events from your primary Google Calendar and your default Microsoft Outlook calendar.

Hence great new feature for one-calender-for-all users! Good news for multi-calender users because now you know at least Google is working on this 2-way syncing issue. Users who purchased Spanning Sync or BusySync (latest beta added support for 2-way syncing between iCal and GCal, for a cheaper price than Spanning Sync), let’s hope Google does not have support for iCal in the development plan.