KDevelop4/Manual/WindowsSetup: Difference between revisions

    From KDE UserBase Wiki
    (Structure a bit more, center pictures)
    (Add details about MinGW, formatting++)
    Line 3: Line 3:
    [[File:kdevelop-windows-mainwindow.png|500px|center]]
    [[File:kdevelop-windows-mainwindow.png|500px|center]]


    KDevelop does not ship a compiler, nor a build system; it is just a tool to edit source code. To actually compile C++ programs, you need a toolchain containing those. There is currently one recommended and supported workflow for developing on Microsoft Windows.
    KDevelop <strong>does not ship a compiler, nor a build system</strong>; it is just a tool to edit source code. To actually compile C++ programs, you need a toolchain containing those. With KDevelop, you can use any compiler available for the Windows platform, be it Microsoft's Visual C++ compiler, or MinGW/GCC or even Clang on Windows. You just need to make sure your environment is set up correctly, so the build system in use (e.g. CMake) can find the compiler.


    == Prerequisites ==
    == Prerequisites ==


    Choose whether to install either GCC via MinGW or the Microsoft Visual Studio IDE. Both ship C/C++ compilers. Installing and using Visual Studio is the recommended & tested workflow at this point.
    Choose whether to install either GCC via MinGW or the Microsoft Visual Studio IDE. Both ship C/C++ compilers. Installing and using Visual Studio is the recommended & tested workflow at this point. The recommended build system is CMake.


    * Install the CMake build system. You can freely download it from here: https://cmake.org/download/
    * Install the CMake build system. You can freely download it from here: https://cmake.org/download/
    === Using Microsoft Visual C++ ===
    * Install the Microsoft Visual C++ compiler. You can download it for free from here: http://landinghub.visualstudio.com/visual-cpp-build-tools.
    * Install the Microsoft Visual C++ compiler. You can download it for free from here: http://landinghub.visualstudio.com/visual-cpp-build-tools.
    ** When installing, make sure you select the "Windows 10 SDK" component (even if you're not on Windows 10), otherwise compiled programs might not run.
    ** When installing, make sure you select the "Windows 10 SDK" component (even if you're not on Windows 10), otherwise compiled programs might not run.
    * By default, CMake will use VC++ if installed and detected
    === Using MinGW/GCC (alternative) ===
    * Install MinGW/GCC: http://www.mingw.org/wiki/InstallationHOWTOforMinGW
    * Note: You <em>must</em> add <em>C:\MinGW\bin</em> to your user PATH environment variable manually (see above HOWTO)
    * When setting up a new build directory, make sure you pass <em>-G "MinGW Makefiles"</em> to CMake so MinGW/GCC is used
    ==== Troubleshooting ====
    More information about the MinGW setup in this Reddit thread: https://www.reddit.com/r/cpp/comments/57x0ev/kdevelop_502_for_windows_and_linux/d8vvy9s/


    == Get KDevelop ==
    == Get KDevelop ==


    * Install KDevelop. Get the installer from here: https://www.kdevelop.org/download.  
    * Install KDevelop
    * Run KDevelop by clicking the ''KDevelop - Microsoft Visual C++ compiler'' shortcut in your start menu, which will set up the necessary environment. [[File:kdevelop-windows-startmenu.png|thumb|500px|center]]
    ** Get the installer from here: https://www.kdevelop.org/download.  
    * Run KDevelop
    ** <strong>If using VC++</strong>: Run KDevelop by clicking the ''KDevelop - Microsoft Visual C++ compiler'' shortcut in your start menu, which will set up the necessary environment.  
    ** <strong>If using MinGW</strong>: Run KDevelop by clicking the "KDevelop" shortcut, but make sure to pass <em>-G "MinGW Makefiles"</em> to CMake when KDevelop asks you for the build directory
    [[File:kdevelop-windows-startmenu.png|thumb|500px|center]]
    * Now, you can use KDevelop's "Build" and "Run" tools as usual. For example, you can create a "Hello World" program by selecting Project -> New from Template -> Standard; then simply click "Build" and "Execute".
    * Now, you can use KDevelop's "Build" and "Run" tools as usual. For example, you can create a "Hello World" program by selecting Project -> New from Template -> Standard; then simply click "Build" and "Execute".

    Revision as of 08:22, 25 October 2016

    Using KDevelop on Windows for C++ development

    KDevelop does not ship a compiler, nor a build system; it is just a tool to edit source code. To actually compile C++ programs, you need a toolchain containing those. With KDevelop, you can use any compiler available for the Windows platform, be it Microsoft's Visual C++ compiler, or MinGW/GCC or even Clang on Windows. You just need to make sure your environment is set up correctly, so the build system in use (e.g. CMake) can find the compiler.

    Prerequisites

    Choose whether to install either GCC via MinGW or the Microsoft Visual Studio IDE. Both ship C/C++ compilers. Installing and using Visual Studio is the recommended & tested workflow at this point. The recommended build system is CMake.

    Using Microsoft Visual C++

    • Install the Microsoft Visual C++ compiler. You can download it for free from here: http://landinghub.visualstudio.com/visual-cpp-build-tools.
      • When installing, make sure you select the "Windows 10 SDK" component (even if you're not on Windows 10), otherwise compiled programs might not run.
    • By default, CMake will use VC++ if installed and detected

    Using MinGW/GCC (alternative)

    • Install MinGW/GCC: http://www.mingw.org/wiki/InstallationHOWTOforMinGW
    • Note: You must add C:\MinGW\bin to your user PATH environment variable manually (see above HOWTO)
    • When setting up a new build directory, make sure you pass -G "MinGW Makefiles" to CMake so MinGW/GCC is used

    Troubleshooting

    More information about the MinGW setup in this Reddit thread: https://www.reddit.com/r/cpp/comments/57x0ev/kdevelop_502_for_windows_and_linux/d8vvy9s/

    Get KDevelop

    • Install KDevelop
    • Run KDevelop
      • If using VC++: Run KDevelop by clicking the KDevelop - Microsoft Visual C++ compiler shortcut in your start menu, which will set up the necessary environment.
      • If using MinGW: Run KDevelop by clicking the "KDevelop" shortcut, but make sure to pass -G "MinGW Makefiles" to CMake when KDevelop asks you for the build directory
    • Now, you can use KDevelop's "Build" and "Run" tools as usual. For example, you can create a "Hello World" program by selecting Project -> New from Template -> Standard; then simply click "Build" and "Execute".