I recently set up, for a learning exercise, an Ubuntu desktop PC with KDE 4.2, installed Eclipse and started to look for information on how to develop for KDE. I know there's KDevelop and will probably have a look at that at some time in the future. Right now, however, I don't have the correct headers and libraries for creating KDE applications in C/C++ using Eclipse. If I have the following:
我最近为学习练习设置了一个带有KDE 4.2的Ubuntu台式PC,安装了Eclipse并开始寻找有关如何为KDE开发的信息。我知道有KDevelop,可能会在将来的某个时间看一下。但是,现在,我没有使用Eclipse在C / C ++中创建KDE应用程序的正确头文件和库。如果我有以下内容:
#include <kapplication.h>
it fails to compile since there are dependancies on other header files that are not present on my hard disk or reference classes that aren't declared anywhere.
它无法编译,因为我的硬盘上没有的其他头文件或未在任何地方声明的引用类存在依赖性。
So, the question is, what packages do I need to install in order to have the correct set of headers to allow me to write applications for KDE 4.2? Are there any packages I shouldn't have? Alternatively, if there are no packages then where can I get the appropriate files?
所以,问题是,我需要安装哪些软件包才能拥有正确的标头集以允许我为KDE 4.2编写应用程序?有没有我不应该的包裹?或者,如果没有包,那么我在哪里可以获得相应的文件?
As a corollary, are there any good tutorials on KDE development, something like the Petzold Windows book?
作为必然结果,有没有关于KDE开发的好教程,比如Petzold Windows书籍?
EDIT: Clarifying what I'm really after: where can I download the correct set of header files / libraries in order to build a KDE application? IDEs to compile code aren't a real problem and are easy to get, as is setting up compiler options for include search paths and so on. Does the KDevelop package have all the correct include and library files or are they separate? I guess they are separate as KDevelop is an IDE that can do other languages as well, but I'm probably wrong. So, the KDE/Qt header files I have don't work, where do I get the right ones?
编辑:澄清我真正追求的是:在哪里可以下载正确的头文件/库集以构建KDE应用程序?编译代码的IDE不是一个真正的问题而且很容易获得,就像为包含搜索路径等设置编译器选项一样。 KDevelop包是否包含所有正确的包含和库文件,还是它们是分开的?我猜它们是分开的,因为KDevelop是一个可以做其他语言的IDE,但我可能错了。所以,我不能使用的KDE / Qt头文件,我在哪里可以得到正确的文件?
Skizz
8 个解决方案
#1
6
Make sure you have installed the build-essential package. For more documentation available from the command line, install glibc-doc, manpages-dev, gcc-*-doc, libstdc++*-doc (replace '*' with suitable version numbers for your system)
确保已安装build-essential软件包。有关命令行中提供的更多文档,请安装glibc-doc,manpages-dev,gcc - * - doc,libstdc ++ * - doc(用适合您系统的版本号替换'*')
Getting Started/Build/KDE4/Kubuntu and Debian had a pair of sudo aptitude install
commands which I used to get some required packages. I also got the KDevelop and QDevelop applications, although I'm not sure they are required. There was also another package I needed (kdelibs5-dev) and this one appears to be the key package. Everything eventually worked after getting that one. Eclipse and KDevelop were both happy building a simple application once the compiler settings were set up; Eclipse required setting search paths and library filenames.
入门/构建/ KDE4 / Kubuntu和Debian有一对sudo aptitude安装命令,我用它来获取一些必需的软件包。我也得到了KDevelop和QDevelop应用程序,虽然我不确定它们是否是必需的。我还需要另一个包(kdelibs5-dev),这个包似乎是关键包。在获得那个之后,一切最终都有效。一旦设置了编译器设置,Eclipse和KDevelop都很乐意构建一个简单的应用程序; Eclipse需要设置搜索路径和库文件名。
From first impressions, Eclipse appears better than KDevelop for the single reason that the tool windows in Eclipse can be detached from the main window and float - useful on a dual monitor setup. I couldn't see anyway to do that in KDevelop (I'm sure someone will comment on how to do this).
从第一次印象看,Eclipse看起来比KDevelop好,原因在于Eclipse中的工具窗口可以从主窗口分离并浮动 - 在双显示器设置上很有用。我无法在KDevelop中看到这样做(我相信有人会评论如何做到这一点)。
#2
2
You might have some clue as to what include in your .classpath
and .project
files if you have a look and examine the content of the CMake used for developing application for KDE4.2
如果您查看并检查用于开发KDE4.2应用程序的CMake的内容,您可能对.classpath和.project文件中包含的内容有一些线索。
I believe the development section of their KDE site is quite complete when it comes to explain their development environment.
alt text http://techbase.kde.org/images/thumb/2/25/Action_configure.svg/40px-Action_configure.svg.png especially their Programming tutorials section.
我相信他们的KDE网站的开发部分在解释他们的开发环境时非常完整。 alt text http://techbase.kde.org/images/thumb/2/25/Action_configure.svg/40px-Action_configure.svg.png特别是他们的编程教程部分。
#3
2
To get all the dependencies required to build an app on Debian (and presumably Ubuntu), use "apt-get build-dep". So pick a random KDE app -- kasteroids? -- and run:
要获得在Debian(可能是Ubuntu)上构建应用程序所需的所有依赖项,请使用“apt-get build-dep”。那么选择一个随机的KDE应用程序 - kasteroids? - 并运行:
apt-get build-dep kasteroids
No need to guess what tools and libraries you need to build a KDE app.
无需猜测构建KDE应用程序所需的工具和库。
#4
1
If Eclipse doesn't provide you with some wizard/initial project setup for a KDE program, I would recommend you to install kdevelop and start such a project there (just write a little Hello World). Then you can look at the files created and follow the build process to get a better understanding and possibly migrate them to Eclipse.
如果Eclipse没有为您提供KDE程序的一些向导/初始项目设置,我建议您安装kdevelop并在那里启动这样的项目(只需编写一个Hello World)。然后,您可以查看创建的文件并遵循构建过程以更好地理解并可能将它们迁移到Eclipse。
Even if you strip off compiler flags for the right include directories, etc. and it works-you should think about using one of the common, established ways to build your software (like qmake for QT, cmake? for KDE,..). If you start using these right now, deploying/distribution your software will be a breeze.
即使您剥离正确包含目录等的编译器标志并且它可以工作 - 您应该考虑使用一种常见的,已建立的方法来构建您的软件(例如qmake for QT,cmake?for KDE,...)。如果您现在就开始使用这些,部署/分发您的软件将是轻而易举的。
#5
1
check out pkg-config.
看看pkg-config。
For example you can see the libraries installed by tiping:
例如,您可以通过tiping查看安装的库:
pkg-config --list-all
For example to find the compilation flags of the gdk library:
例如,要查找gdk库的编译标志:
~$ pkg-config --cflags gdk
-I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include
~$
Eventually you will link with the library and you will need also libraries:
最终你将链接到库,你还需要库:
~$ pkg-config --libs gdk
-lgdk -lXi -lXext -lX11 -lm -lglib
~$
Note: you will need the development libraries installed in order to be able to do that.
注意:您需要安装开发库才能够这样做。
#6
1
I can add a useful tip if you notice that you lack a file and want to find out which package that provides it. Install apt-file, then you can run apt-file search filename to find out the package that contains that file. Note that you have to run apt-file update to get the latest information first.
如果您发现缺少文件并想知道提供它的软件包,我可以添加一个有用的提示。安装apt-file,然后你可以运行apt-file search filename来找出包含该文件的包。请注意,您必须先运行apt-file update才能获取最新信息。
#7
0
Eclipse is far better than Kdevelop, but Eclipse do not have support for developing Kde application. If you want to develop application for KDE, than you should go for Kdevelop. If you are using Qt not kde libraries than use Qt Eclipse QtCreator is another good option for developing Qt applications.
Eclipse远比Kdevelop好,但Eclipse不支持开发Kde应用程序。如果你想为KDE开发应用程序,那么你应该去Kdevelop。如果您使用Qt而不是使用Qt Eclipse而不是使用Qt Eclipse QtCreator是开发Qt应用程序的另一个好选择。
#8
0
I've been using KDevelop4 for a while now and it's been great. KDevelop3 is heavy and has signs of bitrot (300MB RAM usage with one 50k-line project). I have KDevelop4 (since the beta, I've been running trunk lately) and it takes ~100MB of RAM (same project) and the contextual highlighting, awesome completion, and other goodies make it hard to go back to "boring" old syntax highlighting. I don't know if experimental has any builds of it available, but with how many packages that are out there, I would almost be surprised if nobody has them for Debian. Also, all toolbars can be detached in all KDE4 apps, so KDevelop4 has that as well.
我一直在使用KDevelop4一段时间,它一直很棒。 KDevelop3很重,并且有着bitrot的迹象(使用300MB RAM和一个50k线项目)。我有KDevelop4(自测试版以来,我最近一直在运行trunk)并且它需要大约100MB的RAM(相同的项目)和上下文突出显示,非常棒的完成以及其他好东西使得很难回到“无聊的”旧语法高亮。我不知道实验是否有任何可用的版本,但是有多少软件包,如果没有人将它们用于Debian,我几乎会感到惊讶。此外,所有KDE4应用程序中的所有工具栏都可以分离,因此KDevelop4也可以使用它。
#1
6
Make sure you have installed the build-essential package. For more documentation available from the command line, install glibc-doc, manpages-dev, gcc-*-doc, libstdc++*-doc (replace '*' with suitable version numbers for your system)
确保已安装build-essential软件包。有关命令行中提供的更多文档,请安装glibc-doc,manpages-dev,gcc - * - doc,libstdc ++ * - doc(用适合您系统的版本号替换'*')
Getting Started/Build/KDE4/Kubuntu and Debian had a pair of sudo aptitude install
commands which I used to get some required packages. I also got the KDevelop and QDevelop applications, although I'm not sure they are required. There was also another package I needed (kdelibs5-dev) and this one appears to be the key package. Everything eventually worked after getting that one. Eclipse and KDevelop were both happy building a simple application once the compiler settings were set up; Eclipse required setting search paths and library filenames.
入门/构建/ KDE4 / Kubuntu和Debian有一对sudo aptitude安装命令,我用它来获取一些必需的软件包。我也得到了KDevelop和QDevelop应用程序,虽然我不确定它们是否是必需的。我还需要另一个包(kdelibs5-dev),这个包似乎是关键包。在获得那个之后,一切最终都有效。一旦设置了编译器设置,Eclipse和KDevelop都很乐意构建一个简单的应用程序; Eclipse需要设置搜索路径和库文件名。
From first impressions, Eclipse appears better than KDevelop for the single reason that the tool windows in Eclipse can be detached from the main window and float - useful on a dual monitor setup. I couldn't see anyway to do that in KDevelop (I'm sure someone will comment on how to do this).
从第一次印象看,Eclipse看起来比KDevelop好,原因在于Eclipse中的工具窗口可以从主窗口分离并浮动 - 在双显示器设置上很有用。我无法在KDevelop中看到这样做(我相信有人会评论如何做到这一点)。
#2
2
You might have some clue as to what include in your .classpath
and .project
files if you have a look and examine the content of the CMake used for developing application for KDE4.2
如果您查看并检查用于开发KDE4.2应用程序的CMake的内容,您可能对.classpath和.project文件中包含的内容有一些线索。
I believe the development section of their KDE site is quite complete when it comes to explain their development environment.
alt text http://techbase.kde.org/images/thumb/2/25/Action_configure.svg/40px-Action_configure.svg.png especially their Programming tutorials section.
我相信他们的KDE网站的开发部分在解释他们的开发环境时非常完整。 alt text http://techbase.kde.org/images/thumb/2/25/Action_configure.svg/40px-Action_configure.svg.png特别是他们的编程教程部分。
#3
2
To get all the dependencies required to build an app on Debian (and presumably Ubuntu), use "apt-get build-dep". So pick a random KDE app -- kasteroids? -- and run:
要获得在Debian(可能是Ubuntu)上构建应用程序所需的所有依赖项,请使用“apt-get build-dep”。那么选择一个随机的KDE应用程序 - kasteroids? - 并运行:
apt-get build-dep kasteroids
No need to guess what tools and libraries you need to build a KDE app.
无需猜测构建KDE应用程序所需的工具和库。
#4
1
If Eclipse doesn't provide you with some wizard/initial project setup for a KDE program, I would recommend you to install kdevelop and start such a project there (just write a little Hello World). Then you can look at the files created and follow the build process to get a better understanding and possibly migrate them to Eclipse.
如果Eclipse没有为您提供KDE程序的一些向导/初始项目设置,我建议您安装kdevelop并在那里启动这样的项目(只需编写一个Hello World)。然后,您可以查看创建的文件并遵循构建过程以更好地理解并可能将它们迁移到Eclipse。
Even if you strip off compiler flags for the right include directories, etc. and it works-you should think about using one of the common, established ways to build your software (like qmake for QT, cmake? for KDE,..). If you start using these right now, deploying/distribution your software will be a breeze.
即使您剥离正确包含目录等的编译器标志并且它可以工作 - 您应该考虑使用一种常见的,已建立的方法来构建您的软件(例如qmake for QT,cmake?for KDE,...)。如果您现在就开始使用这些,部署/分发您的软件将是轻而易举的。
#5
1
check out pkg-config.
看看pkg-config。
For example you can see the libraries installed by tiping:
例如,您可以通过tiping查看安装的库:
pkg-config --list-all
For example to find the compilation flags of the gdk library:
例如,要查找gdk库的编译标志:
~$ pkg-config --cflags gdk
-I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include
~$
Eventually you will link with the library and you will need also libraries:
最终你将链接到库,你还需要库:
~$ pkg-config --libs gdk
-lgdk -lXi -lXext -lX11 -lm -lglib
~$
Note: you will need the development libraries installed in order to be able to do that.
注意:您需要安装开发库才能够这样做。
#6
1
I can add a useful tip if you notice that you lack a file and want to find out which package that provides it. Install apt-file, then you can run apt-file search filename to find out the package that contains that file. Note that you have to run apt-file update to get the latest information first.
如果您发现缺少文件并想知道提供它的软件包,我可以添加一个有用的提示。安装apt-file,然后你可以运行apt-file search filename来找出包含该文件的包。请注意,您必须先运行apt-file update才能获取最新信息。
#7
0
Eclipse is far better than Kdevelop, but Eclipse do not have support for developing Kde application. If you want to develop application for KDE, than you should go for Kdevelop. If you are using Qt not kde libraries than use Qt Eclipse QtCreator is another good option for developing Qt applications.
Eclipse远比Kdevelop好,但Eclipse不支持开发Kde应用程序。如果你想为KDE开发应用程序,那么你应该去Kdevelop。如果您使用Qt而不是使用Qt Eclipse而不是使用Qt Eclipse QtCreator是开发Qt应用程序的另一个好选择。
#8
0
I've been using KDevelop4 for a while now and it's been great. KDevelop3 is heavy and has signs of bitrot (300MB RAM usage with one 50k-line project). I have KDevelop4 (since the beta, I've been running trunk lately) and it takes ~100MB of RAM (same project) and the contextual highlighting, awesome completion, and other goodies make it hard to go back to "boring" old syntax highlighting. I don't know if experimental has any builds of it available, but with how many packages that are out there, I would almost be surprised if nobody has them for Debian. Also, all toolbars can be detached in all KDE4 apps, so KDevelop4 has that as well.
我一直在使用KDevelop4一段时间,它一直很棒。 KDevelop3很重,并且有着bitrot的迹象(使用300MB RAM和一个50k线项目)。我有KDevelop4(自测试版以来,我最近一直在运行trunk)并且它需要大约100MB的RAM(相同的项目)和上下文突出显示,非常棒的完成以及其他好东西使得很难回到“无聊的”旧语法高亮。我不知道实验是否有任何可用的版本,但是有多少软件包,如果没有人将它们用于Debian,我几乎会感到惊讶。此外,所有KDE4应用程序中的所有工具栏都可以分离,因此KDevelop4也可以使用它。