[CMake] cmake linking problem

Alexander Neundorf a.neundorf-work at gmx.net
Fri Jul 13 08:30:53 EDT 2007


On Friday 13 July 2007 07:26, Anders Sandholm wrote:
> Hi
...
> Now when I build in vs2005 it says:
>
> ---------------------------------------------------------------------------
>---------------------
>
> 1>------ Build started: Project: qtproject, Configuration: Release Win32
> ------ 1>Linking...
> 1>window.obj : error LNK2019: unresolved external symbol "public:
> static struct QMetaObject const Window::staticMetaObject"
> (?staticMetaObject at Window@@2UQMetaObject@@B) referenced in function
> "public: static class QString __cdecl Window::tr(char const *,char
> const *)" (?tr at Window@@SA?AVQString@@PBD0 at Z)

I think these are moc problems.

> # tell cmake to create .moc files for all files in the variable
> qtproject_SRCS that require such a file.
> # note: this assumes that you use #include "header.moc" in your files
> qt4_automoc(${qtproject_SRCS})


So, do your source files include the moc files ?
If not, you have to use qt4_wrap_cpp() to generate the moc sources (which I 
would recommend anyway).

Alex


More information about the CMake mailing list