I was following an introductory tutorial for using the KDE Framework and ran into problems when compiling. The code is the same as in the tutorial. The compiler outputs:
fatal error: KXmlGuiWindow: No such file or directory
My first thought was that I am simply missing a package so I used apt-cache search to search for kxml and installed libkf5xmlgui-dev. Despite that the error persists. I could not references to this error anywhere online. Has the import path been changed? Is another package required?
I am running Kubuntu 20.04.
I previously had to install other packages for compiling the "Hello World" program that did not yet include KXmlGuiWindow, but when I had installed them everything worked fine.
Edit:
find /usr -name KXmlGuiWindow
gave me the output /usr/include/KF5/KXmlGui/KXmlGuiWindow
. I use Atom for my code editor so I compile the program from a terminal by running the commands given in the tutorial which is cmake .. && make
(from a build directory in the project's root directory).
The full output pf that command is
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Installing in the same prefix as Qt, adopting their path scheme.
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- Performing Test HAVE_DATE_TIME
-- Performing Test HAVE_DATE_TIME - Success
-- Found KF5CoreAddons: /usr/lib/x86_64-linux-gnu/cmake/KF5CoreAddons/KF5CoreAddonsConfig.cmake (found version "5.68.0")
-- Found Gettext: /usr/bin/msgmerge (found version "0.19.8.1")
-- Found KF5I18n: /usr/lib/x86_64-linux-gnu/cmake/KF5I18n/KF5I18nConfig.cmake (found version "5.68.0")
-- Found KF5WidgetsAddons: /usr/lib/x86_64-linux-gnu/cmake/KF5WidgetsAddons/KF5WidgetsAddonsConfig.cmake (found version "5.68.0")
-- Found KF5: success (found suitable version "5.68.0", minimum required is "5.2.0") found components: CoreAddons I18n WidgetsAddons
-- The following REQUIRED packages have been found:
* ECM (required version >= 1.0.0)
* Qt5Gui (required version >= 5.12.8)
* Qt5 (required version >= 5.3.0)
* Qt5Core (required version >= 5.12.0)
* KF5CoreAddons (required version >= 5.2.0)
* Gettext
* KF5I18n (required version >= 5.2.0)
* Qt5Widgets (required version >= 5.12.0)
* KF5WidgetsAddons (required version >= 5.2.0)
* KF5 (required version >= 5.2.0)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/simon/Documents/Code/helloWorld/build
Scanning dependencies of target helloworld_autogen
[ 25%] Automatic MOC for target helloworld
[ 25%] Built target helloworld_autogen
Scanning dependencies of target helloworld
[ 50%] Building CXX object CMakeFiles/helloworld.dir/helloworld_autogen/mocs_compilation.cpp.o
[ 75%] Building CXX object CMakeFiles/helloworld.dir/helloWorld.cpp.o
In file included from /home/simon/Documents/Code/helloWorld/helloWorld.cpp:6:
/home/simon/Documents/Code/helloWorld/mainwindow.h:4:10: fatal error: KXmlGuiWindow: No such file or directory
4 | #include <KXmlGuiWindow>
| ^~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/helloworld.dir/build.make:76: CMakeFiles/helloworld.dir/helloWorld.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:82: CMakeFiles/helloworld.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Adding the flag solved one of the errors, the one mentioned in the original post. I still get other errors, but I will look for existing solutions first.