-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMakeFiles/ddcui.dir/src/main/monitor.cpp.o: In function `Monitor::Monitor(DDCA_Display_Info*, int)' #28
Comments
First, I assume you're building from branch 0.2.0-dev, which will soon be released. The master branch is ancient. If class Monitor lacks a vtable something has gotten out of sync in the build. My script for running cmake contains the following lines to ensure that stale values and cached files are not used:
|
In this case please upload the ddcutil dev branch too, because now I'm getting an error that the function ‘ddca_add_trace_groups’ was not declared in this scope. Thanks. |
Use ddcutil branch 1.1.1-dev, which is the current development branch. |
No difference.. Could be this problem caused by an Q_OBJECT(?) - I can't find the implementation of all these functions. |
On a hunch that there are 2 definitions of class Monitor at compilation time, I have replaced all forward declarations "class Monitor" in header files with "include base/monitor.h", and uploaded the changes to branch 0.2.0-dev. |
Your change doesn't solve the problem, but I moved the "monitor" header file, updated all #includes and everything is fine now. Why don't you use qmake instead of cmake? This problem is poorly documented, most users don't have it because the header files are automatically processed by moc if they are in the same folder as the associated cpp. The following link could help you. The header files have to be added to the project using an add_executable or add_library statement. If this is not done, automoc won't parse the files. |
You are quite right about the vtable problem being the result of monitor.h not being processed by the MOC. I owe you an apology for your effort. I forgot that the problem had been addressed over 2 years ago, albeit with a hack, by adding a symbolic link from src/main/monitor.h to src/base/monitor.h. See file src/main/NOTES.TXT. Did the symbolic link get lost when you downloaded the source? If so, how did you download it? As you point out, using set_executable is a more proper way to address the problem. Why is monitor.h located in src/base, not src/main with monitor.cpp? For clarity. I try to make the dependencies of source directories form a directed graph. Why cmake and not qmake? Initially both were implemented. I chose to focus on cmake because it is more generally used. If someone wants to bring ddcui.pro up to production level quality I am amenable to distributing it as well. (ddcui.pro currently exists only in my source tree, not on github.) Regards, |
Yes, I can see your NOTES, although it doesn't solve the problem - I'm getting the same linking error.. I need to build the latest Qt5 before further testing and I'll let you know.. ren@local:~/.build/gcc-11.2.0/build$ ls -la ~/.build/ddcui-0.2.0-dev/src/main/monitor.h ren@local: ~/.build/gcc-11.2.0/build$ ln -sf ~/.build/ddcui-0.2.0-dev/src/base/monitor.h /home/ren/.build/ddcui-0.2.0-dev/src/main/monitor.h ren@local:~/.build/gcc-11.2.0/build$ ls -la ~/.build/ddcui-0.2.0-dev/src/main/monitor.h I downloaded the code using git.. |
The latest updates to branch 0.2.0-dev add src/base/monitor.h to the source file list for set_executable(), and eliminate the symbolic link hack from src/main/monitor.h to src/base/monitor.h. Please rerun cmake (and of course make) and let me know if ddcui builds cleanly. If not, submit the output of cmake and make VERBOSE=1 as attachments, which will hopefully give a clue as to how your environment differs from mine. Thank you. |
I'm getting an error msg (see bellow). Any idea?
Configuration: Ubuntu 18.04, ddutils 1.1.0 (successfully built), Qt5.15.2 (qt515webengine, qt515tools submodules w/ dependencies into /opt/qt515)
CMakeFiles/ddcui.dir/src/main/monitor.cpp.o: In function
Monitor::Monitor(DDCA_Display_Info*, int)': monitor.cpp:(.text+0x29): undefined reference to
vtable for Monitor'monitor.cpp:(.text+0x96): undefined reference to
Monitor::metaObject() const' CMakeFiles/ddcui.dir/src/main/monitor.cpp.o: In function
Monitor::~Monitor()':monitor.cpp:(.text+0x14c): undefined reference to `vtable for Monitor'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ddcui.dir/build.make:912: ddcui] Error 1
make[1]: *** [CMakeFiles/Makefile2:124: CMakeFiles/ddcui.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
The text was updated successfully, but these errors were encountered: