3

(mingw32, windows xp) 你好,我正在尝试从 Java 迁移到 C++。我对查找、安装和编译非标准 c++ 库感到困惑和沮丧。在 Java 中,它非常方便,它们将 Java 标准 api 中所需的所有功能和文档都塞满了。是否有基本 c++ 库的列表,例如线程、gui、网络、图像\音频处理、xml 等。在一个地方?或者可能,作为单个包装提供?

我尝试安装 QT 库数周,它甚至无法编译。在 Java 中,我曾经通过反复试验来学习功能的新方面,但如果我一开始就无法获取和运行新的 api,那将是不可能的。

拜托,我需要你的建议,最初我想摆脱 Java 的抽象,但现在我只想在我决定自己开枪之前能够使用 c++。

4

3 回答 3

2

The C++ standard library is extremely light. It contains nowhere near the functionality offered by the Java runtimes or by the .NET CLR.

The Boost libraries add a whole bunch of functionality to C++, but not much (if any) in the area of user interface.

For UI, there's the question of which platform you're targetting. If it's Win32, then you can use the straight Win32 API (mostly designed for C, but there are some C++ wrappers for parts of it). If you want cross-platform, then you're looking at QT or GTK (although there are others).

But, as Andrew already said: "why do you want to learn C++ anyway?". Don't get me wrong: I program in C++ for a living, and actually enjoy it (although I'm beginning to suspect a case of Stockholm Syndrome). If I had to start again, I'd go with a more modern language and environment (Java or C#; or Ruby or Python).

于 2008-10-23T07:20:12.287 回答
1

我的建议是:一步一步来。

首先,弄清楚如何在代码中包含预构建的库。我建议从ZLib开始(它有一个非常容易使用的设计,而且它也是一个有用的工具)。一旦你让预建库工作,删除它并尝试从源代码编译 ZLib。如果您在任何时候需要帮助,请在 Stack Overflow 上询问,我们会帮您完成。

当你开始工作时,你应该已经掌握了编译和安装 Qt 所需的所有知识。

于 2008-10-23T17:02:30.690 回答
0

线程、XML、网络、一些图像生成、编码和处理——boost提供了这些。至于 XML,例如Arabica - 它通过用漂亮的标准 C++ 气味包装特定于平台的库来抽象出它们。

GUI部分是一个不同的问题。

有 Qt、wxWidgets、带有 c++ 绑定 (gtkmm) 的 gtk、每个平台的本地库及其 C++ 包装器(WTL 是 Win32 的优秀库),但随着 C++ 标准的发展和提升正在成为标准的一部分(C++ 0x 即将推出),没有任何 GUI 框架可以利用这些标准工具并引入自己的工具。不过,他们的工作做得很好。

于 2008-10-23T08:06:35.607 回答