Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Inconsistent DLL linkage; moc_public.cpp conflicts with Qt library object
Mosquito92 last edited by
When linking to a library that implements a Qt status bar, the moc_public.cpp object raises the error "inconsistent dll linkage". I know nothing is actually wrong with the library because it links with several other Qt applications. Only for this one specific Qt application does this library not link. What causes this?
Hi, welcome to the forum.
That's very little information you're giving. It's basically "I have a file and it gives an error. Why?"
Is the moc_public.cpp a file in the library or your app? Is it part of that status bar implementation? The message "inconsistent dll linkage" is part of a warning message, not an error (unless you turned on treating warnings as errors).
Warning C4273 occurs when you mess up the dllexport/import clauses.
For example you might have exported some class/function from the library and then marked it export again in your app and used as if you were importing it.
Other possibility is that you exported a symbol (class, function, whatever), and then redefined it in your app. From your scarce description this might happen if you have a class in the library that generates a moc_ file. Then you imported that library and included the moc_ file in your app. The compiler would now have two definitions of the stuff in the moc_ file. one in the library and one in your app, one marked as export and the other as import, so it complains. If the moc_ file is part of the library don't add it to the app project.