Re: [CMake] QTCreator project to VS2008 problems

2010-03-19 Thread Oli Glaser
Thanks for all the help, I got it working. I was not including the automoc 
generated headers or wrapped ui in the executables, I was adding the 
original files instead.


- Original Message - 
From: "John Drescher" 

To: "Michael Jackson" 
Cc: 
Sent: Friday, March 19, 2010 1:40 PM
Subject: Re: [CMake] QTCreator project to VS2008 problems



I may have worded that badly, so just to clarify - the QT I am using to
create the VS2008 project (the one used with cmake) was compiled with
VS2008, it's just the original code that was created in a mingw compiled
QTCreator. I thought the point of cmake is to enable porting code from 
one

platform to another - or have I misunderstood completely?

Oli


CMake will generate a "build system" for your project on lots of 
different

platforms. Whether your code actually compiles on those systems is up to
you.



I can say that this works. I mean most of my cmake based Qt projects I
develop on Visual Studio work on linux without much difficulty. There
are some compiler and linker differences that I had to take care of
though.

John
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html


Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ


Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] QTCreator project to VS2008 problems

2010-03-19 Thread John Drescher
>> I may have worded that badly, so just to clarify - the QT I am using to
>> create the VS2008 project (the one used with cmake) was compiled with
>> VS2008, it's just the original code that was created in a mingw compiled
>> QTCreator. I thought the point of cmake is to enable porting code from one
>> platform to another - or have I misunderstood completely?
>>
>> Oli
>
> CMake will generate a "build system" for your project on lots of different
> platforms. Whether your code actually compiles on those systems is up to
> you.
>

I can say that this works. I mean most of my cmake based Qt projects I
develop on Visual Studio work on linux without much difficulty. There
are some compiler and linker differences that I had to take care of
though.

John
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] QTCreator project to VS2008 problems

2010-03-19 Thread Michael Jackson

On Mar 19, 2010, at 9:21 AM, Oli Glaser wrote:



- Original Message - From: "John Drescher" >
To: "Oli Glaser" ; "CMake mailing list" >

Sent: Friday, March 19, 2010 1:09 PM
Subject: Re: [CMake] QTCreator project to VS2008 problems


Thanks for the reply - I added mainwindow.h to the automoc but I  
get the
same thing - I thought it might be the QMetaobject header or  
library it was
looking for, looking at the the error messages, but I checked and  
the header
is there, and the search paths are correct. I built the QTProject  
with a

mingw compiled version of QTCreator - this wouldn't matter would it?



No part of Qt or any other library can be built with a different
compiler for this to work. You must build all code with the same
compiler (even service packs can cause problems).

John


I may have worded that badly, so just to clarify - the QT I am using  
to create the VS2008 project (the one used with cmake) was compiled  
with VS2008, it's just the original code that was created in a mingw  
compiled QTCreator. I thought the point of cmake is to enable  
porting code from one platform to another - or have I misunderstood  
completely?


Oli


CMake will generate a "build system" for your project on lots of  
different platforms. Whether your code actually compiles on those  
systems is up to you.


Mike Jackson
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] QTCreator project to VS2008 problems

2010-03-19 Thread Michael Jackson

You may want to take a look at the following sample project:

http://www.cmake.org/Wiki/images/2/25/QtTest-Package-Example.zip

While the project was geared towards OS X specific topics the project  
will compile and run on any platform that Qt is supported on,  
Including MinGW and Visual Studio.


Also of some help may be:

http://www.cmake.org/Wiki/CMake#Tutorials

___
Mike Jackson  www.bluequartz.net
Principal Software Engineer   mike.jack...@bluequartz.net
BlueQuartz Software   Dayton, Ohio


On Mar 19, 2010, at 9:01 AM, Oli Glaser wrote:



- Original Message - From: "John Drescher" >
To: "Oli Glaser" ; "bacula-users" >

Sent: Friday, March 19, 2010 12:46 PM
Subject: Re: [CMake] QTCreator project to VS2008 problems


On Fri, Mar 19, 2010 at 5:58 AM, Oli Glaser  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 "
(?metaobj...@mainwindow@@UBEPBUQMetaObject@@XZ) mainwindow.obj hello
Error 2 error LNK2001: unresolved external symbol "public: virtual  
void *

__thiscall MainWindow::qt_metacast(char const *)"
(?qt_metac...@mainwindow@@uaepax...@z) mainwindow.obj hello
Error 3 error LNK2001: unresolved external symbol "public: virtual  
int
__thiscall MainWindow::qt_metacall(enum QMetaObject::Call,int,void  
* *)"
(?qt_metac...@mainwindow@@uaehw4c...@qmetaobject@@hpa...@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

Hi John,

Thanks for the reply - I added mainwindow.h to the automoc but I get  
the same thing - I thought it might be the QMetaobject header or  
library it was looking for, looking at the the error messages, but I  
checked and the header is there, and the search paths are correct. I  
built the QTProject with a mingw compiled version of QTCreator -  
this wouldn't matter would it?


Oli

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] QTCreator project to VS2008 problems

2010-03-19 Thread Oli Glaser


- Original Message - 
From: "John Drescher" 

To: "Oli Glaser" ; "CMake mailing list" 
Sent: Friday, March 19, 2010 1:09 PM
Subject: Re: [CMake] QTCreator project to VS2008 problems



Thanks for the reply - I added mainwindow.h to the automoc but I get the
same thing - I thought it might be the QMetaobject header or library it 
was
looking for, looking at the the error messages, but I checked and the 
header

is there, and the search paths are correct. I built the QTProject with a
mingw compiled version of QTCreator - this wouldn't matter would it?



No part of Qt or any other library can be built with a different
compiler for this to work. You must build all code with the same
compiler (even service packs can cause problems).

John


I may have worded that badly, so just to clarify - the QT I am using to 
create the VS2008 project (the one used with cmake) was compiled with 
VS2008, it's just the original code that was created in a mingw compiled 
QTCreator. I thought the point of cmake is to enable porting code from one 
platform to another - or have I misunderstood completely?


Oli





___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] QTCreator project to VS2008 problems

2010-03-19 Thread John Drescher
> Thanks for the reply - I added mainwindow.h to the automoc but I get the
> same thing - I thought it might be the QMetaobject header or library it was
> looking for, looking at the the error messages, but I checked and the header
> is there, and the search paths are correct. I built the QTProject with a
> mingw compiled version of QTCreator - this wouldn't matter would it?
>

No part of Qt or any other library can be built with a different
compiler for this to work. You must build all code with the same
compiler (even service packs can cause problems).

John
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] QTCreator project to VS2008 problems

2010-03-19 Thread Oli Glaser


- Original Message - 
From: "John Drescher" 
To: "Oli Glaser" ; "bacula-users" 


Sent: Friday, March 19, 2010 12:46 PM
Subject: Re: [CMake] QTCreator project to VS2008 problems


On Fri, Mar 19, 2010 at 5:58 AM, Oli Glaser  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 "
(?metaobj...@mainwindow@@UBEPBUQMetaObject@@XZ) mainwindow.obj hello
Error 2 error LNK2001: unresolved external symbol "public: virtual void *
__thiscall MainWindow::qt_metacast(char const *)"
(?qt_metac...@mainwindow@@uaepax...@z) mainwindow.obj hello
Error 3 error LNK2001: unresolved external symbol "public: virtual int
__thiscall MainWindow::qt_metacall(enum QMetaObject::Call,int,void * *)"
(?qt_metac...@mainwindow@@uaehw4c...@qmetaobject@@hpa...@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

Hi John,

Thanks for the reply - I added mainwindow.h to the automoc but I get the 
same thing - I thought it might be the QMetaobject header or library it was 
looking for, looking at the the error messages, but I checked and the header 
is there, and the search paths are correct. I built the QTProject with a 
mingw compiled version of QTCreator - this wouldn't matter would it?


Oli

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] QTCreator project to VS2008 problems

2010-03-19 Thread Oli Glaser
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 " 
(?metaobj...@mainwindow@@UBEPBUQMetaObject@@XZ) mainwindow.obj hello

Error 2 error LNK2001: unresolved external symbol "public: virtual void * 
__thiscall MainWindow::qt_metacast(char const *)" 
(?qt_metac...@mainwindow@@uaepax...@z) mainwindow.obj hello

Error 3 error LNK2001: unresolved external symbol "public: virtual int 
__thiscall MainWindow::qt_metacall(enum QMetaObject::Call,int,void * *)" 
(?qt_metac...@mainwindow@@uaehw4c...@qmetaobject@@hpa...@z) mainwindow.obj hello


___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake