Jump to content

Kdevelop4/Manual/Meet KDevelop/zh-cn: Difference between revisions

From KDE Wiki Sandbox
BFW (talk | contribs)
Created page with "==什么是KDevelop?=="
 
Claus chr (talk | contribs)
Created page with "Category:开发/zh-cn"
 
(4 intermediate revisions by one other user not shown)
Line 3: Line 3:
==什么是KDevelop?==
==什么是KDevelop?==


[http://www.KDevelop.org KDevelop] is a modern integrated development environment (IDE) for C++ (and other languages) that is one of many [http://www.kde.org/applications/ KDE applications]. As such it runs on Linux (even if you run one of the other desktops, such as GNOME) but it is also available for most other variants of Unix and for Windows as well.
[http://www.KDevelop.org KDevelop]是一个C++(还有其他语言)的现代集成开发环境,也是一个[http://www.kde.org/applications/ KDE 程序]。它本身在Linux(即使你是用的是其他桌面环境,比如GNOME)下运行,但也可在其他变种的Unix和Windows下运行。


'''KDevelop''' offers all amenities of modern IDEs. For large projects and applications, the most important feature is that '''KDevelop''' ''understands C++'': it parses the entire source base and remembers which classes have which member functions, where variables are defined, what their types are, and many other things about your code. For example, let's say one of your project's header files declares a class
'''KDevelop'''提供现代集成开发环境所拥有的功能。对于大型项目和应用程序,最重要的功能便是'''KDevelop'''能“理解C++'':它会分析整个源代码,并记住哪一各类有哪几个成员函数、变量在哪里被定义、它们是什么类型的以及其他你编程所需的东西。比如说,假设你的项目的头文件声明了一个类


{{Input|<syntaxhighlight lang="cpp">
{{Input|<syntaxhighlight lang="cpp">
Line 25: Line 25:
it will have remembered that <code>my_ride</code> in the last line is a variable of type <code>Car</code> and offer you to complete <code>ge</code> as <code>get_color()</code> since this is the only member function of the <code>Car</code> class that starts like this. Instead of continuing to type you just hit <keycap>Enter</keycap> to get the full word; this saves typing, avoids typos, and doesn't require you to remember the exact names of the hundreds or thousands of functions and classes that make up large projects.  
it will have remembered that <code>my_ride</code> in the last line is a variable of type <code>Car</code> and offer you to complete <code>ge</code> as <code>get_color()</code> since this is the only member function of the <code>Car</code> class that starts like this. Instead of continuing to type you just hit <keycap>Enter</keycap> to get the full word; this saves typing, avoids typos, and doesn't require you to remember the exact names of the hundreds or thousands of functions and classes that make up large projects.  


As a second example, assume you have code like this:
第二个例子,假设你有这样的代码:


<!--}}-->{{Input|<syntaxhighlight lang="cpp">
<!--}}-->{{Input|<syntaxhighlight lang="cpp">
Line 51: Line 51:
}}
}}


[[Category:Development]]
[[Category:开发/zh-cn]]

Latest revision as of 08:24, 9 August 2012

什么是KDevelop?

KDevelop是一个C++(还有其他语言)的现代集成开发环境,也是一个KDE 程序。它本身在Linux(即使你是用的是其他桌面环境,比如GNOME)下运行,但也可在其他变种的Unix和Windows下运行。

KDevelop提供现代集成开发环境所拥有的功能。对于大型项目和应用程序,最重要的功能便是KDevelop能“理解C++:它会分析整个源代码,并记住哪一各类有哪几个成员函数、变量在哪里被定义、它们是什么类型的以及其他你编程所需的东西。比如说,假设你的项目的头文件声明了一个类

class Car {
  // ...
  public:
    std::string get_color () const;
};

and later on in your program you have

Car my_ride;
// ...do something with this variable...
std::string color = my_ride.ge

it will have remembered that my_ride in the last line is a variable of type Car and offer you to complete ge as get_color() since this is the only member function of the Car class that starts like this. Instead of continuing to type you just hit Enter to get the full word; this saves typing, avoids typos, and doesn't require you to remember the exact names of the hundreds or thousands of functions and classes that make up large projects.

第二个例子,假设你有这样的代码:

double foo ()
{
  double var = my_func();
  return var * var;
}

double bar ()
{
  double var = my_func();
  return var * var * var;
}

If you hover the mouse over the symbol var in function bar you get the option to see all uses of this symbol. Clicking on it will only show you the uses of this variable in function bar because KDevelop understands that the variable var in function foo has nothing to do with it. Similarly, right clicking on the variable name allows you to rename the variable; doing so will only touch the variable in bar but not the one with the same name in foo.

But KDevelop is not just an intelligent code editor; there are other things KDevelop does well. Obviously, it highlights the source code in different colors; it has a customizable indenter; it has an integrated interface to the GNU debugger gdb; it can show you the documentation for a function if you hover the mouse over a use of this function; it can deal with different kinds of build environments and compilers (e.g. with make and cmake-based project), and many other neat things that are discussed in this manual.