Kdevelop5/Manual/Meet KDevelop/da: Difference between revisions

From KDE UserBase Wiki
(Created page with "og at du et andet sted i programmet har")
(Created page with "{{Input|<syntaxhighlight lang="cpp"> Car my_ride; // ...gør noget med denne variabel... std::string color = my_ride.ge </syntaxhighlight>}}")
Line 31: Line 31:
{{Input|<syntaxhighlight lang="cpp">
{{Input|<syntaxhighlight lang="cpp">
Car my_ride;
Car my_ride;
// ...do something with this variable...
// ...gør noget med denne variabel...
std::string color = my_ride.ge
std::string color = my_ride.ge
</syntaxhighlight>}}
</syntaxhighlight>}}

Revision as of 07:12, 27 August 2017


Hvad er KDevelop?

KDevelop er et moderne integreret udviklingsmiljø (IDE) til C++ (og andre sprog), som er et blandt mange KDE-programmer. Som sådan kører det på Linux (også hvis du kører en af de andre skriveborde, så som GNOME), men er også tilgængelig til de fleste varianter af Unix så vel som til Windows.


KDevelop frembyder alle et moderne IDE's bekvemmeligheder. Til store projekter og programmer er KDevelops vigtigste funktion, at den forstår C++: den fortolker hele kildekoden og husker, hvilke klasser der har hvilke medlemsfunktioner, hvor variable bliver defineret, hvilken type de har og mange andre ting om din kode. Lad os for eksempel sige, at dit projekts headerfiler deklarerer en klasse


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


og at du et andet sted i programmet har


Car my_ride;
// ...gør noget med denne variabel...
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.