https://bugs.kde.org/show_bug.cgi?id=462611
            Bug ID: 462611
           Summary: Info on how to get started using KPMcore library is
                    incomplete
    Classification: Applications
           Product: partitionmanager
           Version: Git
          Platform: Debian stable
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: andr...@stikonas.eu
          Reporter: ross.boy...@ucsf.edu
  Target Milestone: ---

SUMMARY
Please provide enough information in README.md to use the library.


DETAILS
The Initialization section provides some scraps of code, but not a complete
working example.  I have so far been unable to make the transition.  Here are
the issues I've encountered:
   1. `Device` not declared in this scope.  Solution: add `#include
<core/device.h>`
   2. `backend` not declared in this scope.  I've tried a lot of variations to
get it; none have worked.

`CoreBackendManager.h` says
```
  * This is basically a singleton class to give the application access to the
currently
  * selected backend and also to manage the available backend plugins.
```
But my latest variation, `QList<Device*> devices =
CoreBackendManager()->backend()->scanDevices(false);`, yields
```
build] ../test.cpp: In function ‘int main(int, char**)’:
[build] ../test.cpp:32:49: error: ‘CoreBackendManager::CoreBackendManager()’ is
private within this context
[build]    32 |     QList<Device*> devices =
CoreBackendManager()->backend()->scanDevices(false);
[build]       |                                                 ^
[build] In file included from ../test.cpp:6:
[build] /usr/include/kpmcore/backend/corebackendmanager.h:34:5: note: declared
private here
[build]    34 |     CoreBackendManager();
[build]       |     ^~~~~~~~~~~~~~~~~~
[build] ../test.cpp:32:49: error: ‘CoreBackendManager::~CoreBackendManager()’
is private within this context
[build]    32 |     QList<Device*> devices =
CoreBackendManager()->backend()->scanDevices(false);
[build]       |                                                 ^
[build] In file included from ../test.cpp:6:
[build] /usr/include/kpmcore/backend/corebackendmanager.h:35:5: note: declared
private here
[build]    35 |     ~CoreBackendManager();
[build]       |     ^
[build] ../test.cpp:32:50: error: base operand of ‘->’ has non-pointer type
‘CoreBackendManager’
[build]    32 |     QList<Device*> devices =
CoreBackendManager()->backend()->scanDevices(false);
```

This code gets called after the suggested `initKPMcore`, though since this is a
compile-time error that may not matter.

CMAKE PROBLEMS
I had lots of trouble getting the test project to find the right include files
with `CMake`, mostly because I overlooked the steps you did document in the
`README`.  But one part of the instructions seemed odd, the requirement to
explicitly add the include path.  The
[tutorial](https://community.kde.org/Guidelines_and_HOWTOs/CMake/Frameworks)
says that adding an explicit link target will automatically take care of
includes: "This [that is the target_link_libraries declaration] will not only
link the tutorial target against the KArchive library, it will set up the
include paths properly as well."  Is there a reason that pattern doesn't apply
here (I tried; the link declaration alone definitely is insufficient)?

VERSIONS
My test code is running against the development libraries packaged for Debian
bullseye, libkpmcore10        20.12.3-2, though I've mostly been looking at the
source from git.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to