Bacula-users

Re: [Bacula-users] [CMake] QTCreator project to VS2008 problems

2010-03-19 08:48:23
Subject: Re: [Bacula-users] [CMake] QTCreator project to VS2008 problems
From: John Drescher <drescherjm AT gmail DOT com>
To: Oli Glaser <oli AT glasers DOT org>, bacula-users <Bacula-users AT lists.sourceforge DOT net>
Date: Fri, 19 Mar 2010 08:46:06 -0400
On Fri, Mar 19, 2010 at 5:58 AM, Oli Glaser <oli AT glasers DOT org> wrote:
> I am new to cmake and QT so I thought I'd build a test project (basic forms
> app with two source files) in QTCreator and use CMake to port it to
> VS2008 to test it out. I have tried to pick the commands I need for the
> CMakefiles from the documentation. The cmake configure and generate went
> okay, but when I tried to build in VS, I got linker errors so I added the
> command to link the QT libraries (built with VS2008) and most of them
> disappeared apart from 3, I'm not sure what it's looking for now - can
> anyone help? here is my makefile and VS errors:
>
> project(hello)
> IF(NOT UNIX AND NOT MINGW)
>   SET(MITK_WIN32_FORCE_STATIC "STATIC" CACHE INTERNAL "Use this variable to
> always build static libraries on non-unix platforms")
> ENDIF()
> find_package(Qt4 4.5.2 COMPONENTS QtCore QtGui QtXml REQUIRED )
> include(${QT_USE_FILE})
> QT4_AUTOMOC(main.cpp mainwindow.cpp)
> add_library(LIB main.cpp)
> include_directories (${HELLO_SOURCE_DIR})
> link_directories(${HELLO_SOURCE_DIR})
> set(SRC main.cpp
>  mainwindow.cpp)
> add_executable(hello ${SRC})
> target_link_libraries(hello ${QT_LIBRARIES})
>
> VS Errors
>
> Error 1 error LNK2001: unresolved external symbol "public: virtual struct
> QMetaObject const * __thiscall MainWindow::metaObject(void)const "
> (?metaObject@MainWindow@@UBEPBUQMetaObject@@XZ) mainwindow.obj hello
> Error 2 error LNK2001: unresolved external symbol "public: virtual void *
> __thiscall MainWindow::qt_metacast(char const *)"
> (?qt_metacast@MainWindow@@UAEPAXPBD@Z) mainwindow.obj hello
> Error 3 error LNK2001: unresolved external symbol "public: virtual int
> __thiscall MainWindow::qt_metacall(enum QMetaObject::Call,int,void * *)"
> (?qt_metacall@MainWindow@@UAEHW4Call@QMetaObject@@HPAPAX@Z) mainwindow.obj hello
>
>

To me this is a problem with what gets run with moc.I am using Qt and
vs2008 every day so I can assure you that it works. Try adding the
header file to the auto moc. You should have the header files in the
source anyways.

See here for an example:

http://www.vtk.org/Wiki/VTK/Examples/Qt/RenderWindowUi


John

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [Bacula-users] [CMake] QTCreator project to VS2008 problems, John Drescher <=