享受生活 - Enjoy Life!

Just so so.

Archive for the ‘Programming’ tag

体会了一下Snow Leopard的一个开发bug

1 篇评论

终于在公司搞到了一台旧的iMac 5.1, Intel Core 2 Duo 2.0 GHz/ 2G DDR2 667 MHz。

装上了Snow Leopard和官方发布的Qt 4.7.0 Beta 2Qt Creator 2.1快照版,想debug进Qt库,竟然不成,咨询了公司内外的Mac开发朋友,原来我遇到了Apple的bug。

DYLD_IMAGE_SUFFIX=_debug makes application crash on Mac OS X – Snow Leopard
DYLD_IMAGE_SUFFIX causing havoc on Mac OS X Snow Leopard

而且变态的Apple自己的bug tracker还是封闭的,只有号码,看不到具体情况。

最后的解决办法是:

cd /usr/lib
sudo mv libSystem.B_debug.dylib libSystem.B_debug.dylib.bak
sudo mv libmx.A_debug.dylib libmx.A_debug.dylib.bak

之前还以为/Developers/SDKs/MacOSX10.6.sdk/usr/lib的有效呢。

BTW,学习了OS X下的ldd就是otool

其它参考文档:
Technical Note TN2124: Mac OS X Debugging Magic

作者:Cavendish

时间:10/07/13 4:19 下午

分类: 技术

标签:, ,

How to support your own type in QVariant

没有评论

#include <QCoreApplication>
#include <QVariant>
#include <QString>

struct MyStruct
{
    int a;
    double b;
    QString c;
};

struct MyPowerStruct
{
    int a;
    double b;
    MyStruct c;
};

Q_DECLARE_METATYPE(MyStruct)
Q_DECLARE_METATYPE(MyPowerStruct)

int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);
    MyStruct v01 = { 1, 5.0, QString("Nokia Qt") };
    QVariant var0;
    var0.setValue(v01);
    MyStruct v02 = var0.value();
    MyPowerStruct v11 = { 10, 0.5, {1, 5.0, QString("Nokia Qt") } };
    QVariant var1;
    var1.setValue(v11);
    MyPowerStruct v12 = var1.value();
    return 0;
}

Reference:
Qt 4.6 Documentation: Q_DECLARE_METATYPE

作者:Cavendish

时间:10/05/06 6:38 下午

分类: 技术

标签:,

Build Qt with S60 5.0 Public SDK

没有评论

Build Qt with S60 5.0 Public SDK

Platform: Windows XP with SP3(now we only support Qt/S60 on it.)

1. SYMBIAN Development Environment

For downloading the packages, you need to register an account in the forum of Nokia,
http://www.forum.nokia.com/main/registration/registration.html

1-1. Carbide.C++
http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/IDEs/Carbide.c++/
http://sw.nokia.com/id/7710eba7-4da7-4ddc-a52a-53b506cadb4a/Carbide_cpp_v2_0_en.exe

Carbide.C++ 2.0
Carbide_cpp_v2_0_en.exe 203MB

1-2. S60 Platform SDKs for Symbian OS, for C++
http://www.forum.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html
http://sw.nokia.com/id/577ad48d-290c-4bb5-8bdf-779ea8a5bc6c/S60_5th_Edition_SDK_v1_0_en.zip

S60 Platform SDKs for Symbian OS, for C++, 5th Edition
S60_5th_Edition_SDK_v1_0_en.zip 622MB

2. Installation

Please install above 2 packages as default path.

Installation order: Carbide.C++, S60 SDK.

After Carbide.C++, you may need to install ActivePerl-5.6.1.638-MSWin32-x86.msi:

http://downloads.activestate.com/ActivePerl/Windows/5.6/ActivePerl-5.6.1.638-MSWin32-x86.msi

And you also need to use Git to get Qt from Qt S60 Git Repo, better to download this version of Git.

Please also make sure the path of our perl(default: C:\Perl\bin) should be before the perl in git(default: C:\Program Files\Git\bin) in PATH.

Please run this, Start->Carbide.c++ v2.0->Configure environment for WINSCW command line.

3. Build Qt with S60 5.0 Public SDK

cd C:\git
git clone git://gitorious.org/+qt-s60-developers/qt/qt-s60.git
cd qt-s60
set PATH=C:\git\qt-s60\bin;%PATH%
configure -platform win32-mwc -xplatform symbian-abld -openssl-linked -qt-sql-sqlite -system-sqlite
make debug-winscw

4. Build Examples

cd C:\git\qt-s60\examples\widgets\analogclock
qmake
make debug-winscw
C:\S60\devices\S60_5th_Edition_SDK_v1.0\epoc32\release\winscw\udeb\epoc.exe
“Menu”(or click the middle one of the 3 buttons)->QtExamples->analogclock

You got it!

作者:Cavendish

时间:09/05/26 11:02 下午

分类: 技术

标签:, ,

Welcome to Qt/Kinetic

没有评论

Qt Labs – Welcome to Kinetic
Kinetic Project
Git clone URL: git://labs.trolltech.com/qt/kinetic

作者:Cavendish

时间:08/11/06 2:17 下午

分类: 技术

标签:,

Qt Animation Framework发布了

没有评论

作者:Cavendish

时间:08/11/05 4:45 下午

分类: 技术

标签:,

Qt Creator(跨平台的IDE)技术预览版发布了

没有评论

作者:Cavendish

时间:08/10/30 1:39 下午

分类: 技术

标签:,

Build Qt with OpenSSL, VC++ 2005 EE(SP1) on Windows XP

没有评论

Build Qt with OpenSSL, VC++ 2005 EE(SP1) on Windows XP

1. OS, Compilers and SDK
OS: Windows XP(SP3)
Compiler: Microsoft Visual C++ 2005 Express Edition with Service Pack 1
SDK: Windows Software Development Kit (SDK) for Windows Server 2008 and .NET Framework 3.5

You need set SDK path in your compiler settings by yourself.

2. Build OpenSSL 0.9.8h
Download OpenSSL 0.9.8h Original Source Package, unpack it to C:\openssl-0.9.8h.
Please read C:\openssl-0.9.8h\INSTALL.W32.

Open the Visual Studio 2005 Command Prompt, then

cd C:\openssl-0.9.8h
perl Configure VC-WIN32 --prefix=c:/OpenSSL
ms\do_ms
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak test
nmake -f ms\ntdll.mak install

3. Build Qt with OpenSSL
Download qt-win-opensource-src-4.4.3.zip, unpack it to C:\Qt\4.4.3-oss.

Open the Visual Studio 2005 Command Prompt, then

set INCLUDE=C:\openssl-0.9.8h\include;%INCLUDE%
set LIBPATH=C:\openssl-0.9.8h\lib;%LIBPATH%
set PATH=C:\openssl-0.9.8h\bin;C:\Qt\4.4.3-oss\bin;%PATH%
cd C:\Qt\4.4.3-oss\
configure.exe -release -openssl
nmake sub-src

cd examples\network\securesocketclient
qmake
nmake
cd releasese
curesocketclient

作者:Cavendish

时间:08/10/27 2:54 下午

分类: 技术

标签:, ,

Build Qt for Symbian

1 篇评论

About Symbian development environment, please have a look at:
SYMBIAN Development Environment – 1
SYMBIAN Development Environment – 2

Build Qt for Symbian

Platform: Windows XP with SP3(now we only support Qt/S60 on it.)

0. Patches

Patches for S60 development environment

1. Build Qt for symbian

qt-embedded-s60-opensource-src-4.4.2-pyramid.zip

You need to make sure to use Symbian X86 compiler (version 3.2.5 build 473).

Follow this steps in C:\Qt\4.4.2-pyramid\doc\install-s60.html

Uncompress the package and put it in C:\Qt\4.4.2-pyramid.

Set your PATH including C:\Qt\4.4.2-pyramid\bin.

Configure:

C:
cd \Qt\4.4.2-pyramid
configure -platform win32-mwc -xplatform symbian-abld -qconfig symbian

Build:

bldmake bldfiles
abld build winscw udeb

Notice: Please store the Qt/S60 repository and Symbian SDK in the same hard disk drive, maybe you can store them in different drives, and then use tools like WinMount to mount them to same drive.

Before configure and build, you need set EPOCROOT to your SDK, I use “/S60/devices/S60_3rd_FP2_SDK/”, just because my sdk is in C:\S60\devices\S60_3rd_FP2_SDK.

2. Build Examples

2-1. How to build Qt/S60 application

C:\Qt\4.4.2-pyramid\doc\s60-with-qt-introduction.html

Please make sure to use the qmake in your Qt/S60 build.

qmake
bldmake bldfiles
abld build winscw udeb

Run Carbide.c++ v1.3, In the tab of “Symbian Project Navigator”, right click mouse in white space, choose “Import”, in the “Import” dialog, choose “Symbian OS Bld.inf file” under “Symbian OS”, then “Next”, then “Browse…” to choose the bld.inf in above directory. Then you could build it, run it and debug it in Carbide.c++.

2-2. XML HTML info Example

C:\Qt\4.4.2-pyramid\doc\xml-htmlinfo.html

Note: Standard out is redirected on some platforms. On Symbian using Open C stdout is by default directed to the console window, but this window may not always be visible. To redirect to a file instead, locate the c:\\system\\data\\config.ini file (on either the emulator or the device) and change STDOUT to point to MEDIA4. This will redirect the console to c:\\system\\data\\out.txt.

For me, the config.ini is C:\S60\devices\S60_3rd_FP2_SDK\epoc32\winscw\c\system\data\config.ini, the out.txt is C:\S60\devices\S60_3rd_FP2_SDK\epoc32\winscw\c\system\data\out.txt.

Run the Emulator, Start->S60 Developer Tools->3rd Edition FP2 SDK->Emulator.

In the Emulator, go to Menu->Installations->eshell, and type htmlinfo in prompt mode.

2-3. analogclock Example

Now it works fine for me.

Qt/S60 team are still working on the project to make all things work.

3. Build Qt applications for your mobile phone

Please have a look at C:\Qt\4.4.2-pyramid\README and C:\Qt\4.4.2-pyramid\INSTALL.

Just go to your Qt application directory,

qmake
bldmake bldfiles
abld build gcce udeb

Create a package for your mobile phone:

createpackage yourqtapplication_gcce_udeb.pkg

Note: Now the package will include Qt library in the .pkg file, if you already have a Qt application package installed, maybe you can’t install the next one. Then please remove these lines from the .pkg file of your second application.

“\epoc32\release\gcce\udeb\QtGui.dll” – “c:\sys\bin\QtGui.dll”
“\epoc32\release\gcce\udeb\QtNetwork.dll” – “c:\sys\bin\QtNetwork.dll”
“\epoc32\release\gcce\udeb\QtCore.dll” – “c:\sys\bin\QtCore.dll”

作者:Cavendish

时间:08/10/20 1:46 下午

分类: 技术

标签:, ,

SYMBIAN Development Environment – 2

没有评论

Platform: Linux and OS X

http://www.martin.st/symbian/

作者:Cavendish

时间:08/07/22 11:38 上午

分类: 技术

标签:, ,

SYMBIAN Development Environment – 1

6 篇评论

SYMBIAN Development Environment (1)

Platform: Windows XP Pro(SP3)

1. Software Packages

For downloading the packages, you need to register an account in the forum of Nokia,
http://www.forum.nokia.com/main/registration/registration.html

1-1. Carbide.C++
http://www.forum.nokia.com/main/resources/tools_and_sdks/carbide/
http://www.forum.nokia.com/info/sw.nokia.com/id/dbb8841d-832c-43a6-be13-f78119a2b4cb.html

Carbide.C++ 1.3
Carbide.c++_v1.3.exe 185MB

1-2. S60 Platform SDKs for Symbian OS, for C++
http://www.forum.nokia.com/info/sw.nokia.com/id/4a7149a5-95a5-4726-913a-3c6f21eb65a5/S60-SDK-0616-3.0-mr.html

S60 Platform SDKs for Symbian OS, for C++, 3rd Edition, Feature Package 2(FP2)
S60-3.2-SDK-f.inc3.2130.zip 438MB

1-3. Open C/C++ Plug-ins for S60 3rd Edition
http://www.forum.nokia.com/info/sw.nokia.com/id/91d89929-fb8c-4d66-bea0-227e42df9053/Open_C_SDK_Plug-In.html

Plugin_For_S60_3rd_Ed.zip 41.3MB

2. Installation

Please install above 3 packages as default path.

Installation order: Carbide.C++, S60 SDK, Plugin.

After Carbide.C++, you may need to install ActivePerl-5.6.1.635-MSWin32-x86.msi:

http://downloads.activestate.com/ActivePerl/Windows/5.6/ActivePerl-5.6.1.635-MSWin32-x86.msi

3. Emulator
Start->S60 Developer Tools->Emulator

4. Try first example application for S60

Run Carbide.C++ 1.3
Start->Carbide.c++ v1.3->Carbide.c++ v1.3

In the welcome page, you could click “Tutorials”->”Create an application emulator debug example”, and follow this tutorial to build your first example application for S60.

(Info: If the welcome page takes all space of the workspace in Carbide.c++, it makes you can’t find the project tree and other things, PLEASE CLICK “Restore” OPTION IN THE TOP-RIGHT CORNER OF THE WELCOME PAGE!)

Follow above steps to create your project, but if you can’t see any template in “New Symbian OS C++ Project” dialog when you enable “Filter templates based on enabled SDKs”, it means Carbide.c++ doesn’t find the SDK which you had installed. Then please cancel the dialog.

In the main menu of Carbide.c++, Window->Preferences->Carbide.c++->SDK Preferences, you will find out there is nothing in the “Available Symbian OS SDKs”. Please click “Add New SDK”, in the “Add New SDK” dialog, SDK ID: should be “S60_3rd_FP2_SDK”, EPOCROOT: should be “C:\S60\devices\S60_3rd_FP2_SDK”, Vendor: should be “com.nokia.s60″, Is Default: should be “yes”. Then click “OK” on it. Click “Rescan All SDKs” and “OK”.

Now you can return to your project.

Follow the tutorial, you could run the application in the emulator, in my case the emulator path should be: C:\S60\devices\S60_3rd_FP2_SDK\epoc32\release\winscw\udeb\epoc.exe

Why not try it on your phone?

Copy C:\Symbian\Carbide\workspace\Oroborous\sis\Oroborous_S60_3_X_v_1_0_0.sisx to your phone via usd disk mode. Install it and run it.

If you got some errors like that “Certificate error. Contact the application supplier.”, you need to set your phone like this:
Installations->App. mgr.->Options->Settings, choose “All” for “Software installation”.

Then all should be ok.

作者:Cavendish

时间:08/07/21 3:53 下午

分类: 技术

标签:, ,