Kdevelop5/Manual/Meet KDevelop: Difference between revisions

From KDE UserBase Wiki
(adding menu on the start)
m (Changed code block highlighting)
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
<translate>
<translate>


<!--T:1-->
{{Prevnext2
{{Prevnext2
| nextpage=Special:MyLanguage/KDevelop5/Manual/Sessions_and_projects
| nextpage=Special:MyLanguage/KDevelop5/Manual/Sessions_and_projects
Line 9: Line 10:




==What is KDevelop?==  
==Meet KDevelop== <!--T:2-->




<!--T:3-->
[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] 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.




<!--T:4-->
'''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''' 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




{{Input|<syntaxhighlight lang="cpp">
<!--T:5-->
<syntaxhighlight lang="cpp" line>
class Car {
class Car {
   // ...
   // ...
Line 24: Line 28:
     std::string get_color () const;
     std::string get_color () const;
};
};
</syntaxhighlight>}}
</syntaxhighlight>




<!--T:6-->
and later on in your program you have
and later on in your program you have




{{Input|<syntaxhighlight lang="cpp">
<!--T:7-->
<syntaxhighlight lang="cpp" line>
Car my_ride;
Car my_ride;
// ...do something with this variable...
// ...do something with this variable...
std::string color = my_ride.ge
std::string color = my_ride.ge
</syntaxhighlight>}}
</syntaxhighlight>




<!--T:8-->
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.  




<!--T:9-->
As a second example, assume you have code like this:
As a second example, assume you have code like this:




<!--}}-->{{Input|<syntaxhighlight lang="cpp">
<!--T:10-->
<!--}}--><syntaxhighlight lang="cpp" line>
double foo ()
double foo ()
{
{
Line 51: Line 60:




<!--T:11-->
double bar ()
double bar ()
{
{
Line 56: Line 66:
   return var * var * var;
   return var * var * var;
}
}
</syntaxhighlight>}}<!--{{-->
</syntaxhighlight><!--{{-->




<!--T:12-->
If you hover the mouse over the symbol <code>var</code> in function <code>bar</code> 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 <code>bar</code> because '''KDevelop''' understands that the variable <code>var</code> in function <code>foo</code> 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 <code>bar</code> but not the one with the same name in <code>foo</code>.
If you hover the mouse over the symbol <code>var</code> in function <code>bar</code> 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 <code>bar</code> because '''KDevelop''' understands that the variable <code>var</code> in function <code>foo</code> 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 <code>bar</code> but not the one with the same name in <code>foo</code>.




<!--T:13-->
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.
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.




<!--T:14-->
{{Prevnext2
{{Prevnext2
| nextpage=Special:MyLanguage/KDevelop5/Manual/Sessions_and_projects
| nextpage=Special:MyLanguage/KDevelop5/Manual/Sessions_and_projects
Line 72: Line 85:




<!--T:15-->
[[Category:Development]]
[[Category:Development]]
</translate>
</translate>

Latest revision as of 17:03, 28 March 2020


Meet KDevelop

KDevelop is a modern integrated development environment (IDE) for C++ (and other languages) that is one of many 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.


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


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.


As a second example, assume you have code like this:


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.