PDA

View Full Version : got problem when compiled QxOrm.



olekhanchai
10th April 2012, 03:11
Hello,
I'm new in Qt Programming and I'm not very well in english.
I'm interesting in your QxOrm very much. It's look like powerful program.
I was download Boost Library and QxOrm compiled and install it.
Everything compiled OK. and then I used your sample code to test it.
But I got the error and got red underline on
QX_REGISTER_HPP_MY_TEST_EXE(drug, qx::trait::no_base_class_defined, 1)
and
QX_REGISTER_CPP_MY_TEST_EXE(drug)
when I compiled it.
what should I solution this problem?
my project.pro is :

QT += core QxOrm

QT -= gui

TARGET = drugexample
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app


SOURCES += main.cpp \
drug.cpp

HEADERS += \
drug.h

it's generated by Qt console program.

Best Regard,
Ole

ChrisW67
10th April 2012, 04:56
Hello Ole,

The "Quick example step by step" is incomplete. You need to add:

precompiled.h:


#ifndef _QX_TEST_PRECOMPILED_HEADER_H_
#define _QX_TEST_PRECOMPILED_HEADER_H_

#include <QxOrm.h>

#include "export.h"

#endif // _QX_TEST_PRECOMPILED_HEADER_H_


export.h


#ifndef _MY_TEST_EXE_EXPORT_H_
#define _MY_TEST_EXE_EXPORT_H_

#ifdef _BUILDING_MY_TEST_EXE
#define MY_TEST_EXE_DLL_EXPORT QX_DLL_EXPORT_HELPER
#else // _BUILDING_MY_TEST_EXE
#define MY_TEST_EXE_DLL_EXPORT QX_DLL_IMPORT_HELPER
#endif // _BUILDING_MY_TEST_EXE

#ifdef _BUILDING_MY_TEST_EXE
#define QX_REGISTER_HPP_MY_TEST_EXE QX_REGISTER_HPP_EXPORT_DLL
#define QX_REGISTER_CPP_MY_TEST_EXE QX_REGISTER_CPP_EXPORT_DLL
#else // _BUILDING_MY_TEST_EXE
#define QX_REGISTER_HPP_MY_TEST_EXE QX_REGISTER_HPP_IMPORT_DLL
#define QX_REGISTER_CPP_MY_TEST_EXE QX_REGISTER_CPP_IMPORT_DLL
#endif // _BUILDING_MY_TEST_EXE

#endif // _MY_TEST_EXE_EXPORT_H_


and a pro file like:


TEMPLATE = app
TARGET = test

CONFIG += precompile_header
PRECOMPILED_HEADER = precompiled.h

INCLUDEPATH += /usr/local/QxOrm/include
LIBS += -L/usr/local/QxOrm/lib -lQxOrm

# Input
HEADERS += drug.h
SOURCES += drug.cpp main.cpp

olekhanchai
10th April 2012, 08:38
Hello ChrisW67,
Thanks for your reply. I was compiled everything in Microsoft Windows 7 and use CYGWIN to build library. Everything was compiled OK. But it's still not work then it's has another occur like this :

debug/drug.o: In function `extended_type_info_typeid':
c:/Qt/2010.05/qt/include/boost/serialization/extended_type_info_typeid.hpp:86: undefined reference to `boost::serialization::typeid_system::extended_typ e_info_typeid_0::extended_type_info_typeid_0(char const*)'
c:/Qt/2010.05/qt/include/boost/serialization/extended_type_info_typeid.hpp:88: undefined reference to `boost::serialization::typeid_system::extended_typ e_info_typeid_0::type_register(std::type_info const&)'
c:/Qt/2010.05/qt/include/boost/serialization/extended_type_info_typeid.hpp:89: undefined reference to `boost::serialization::extended_type_info::key_reg ister() const'
.
.
.
seem like it's not link to library, right?
I try to compiled boost with visual studio 2008 and then it have error occur because the "libboost_serialization-vc90-mt-gd-1_42" not found.
when I change the solution to compiled with CYGWIN everything is OK and it can be build QxOrm too.
I was change my file with your recommendation and then it still error occur that I shown you on the top. What should I do?
So sorry about my english skill and thanks a lot for your help.

Best Regards,
Ole.

ChrisW67
11th April 2012, 02:12
Then you need to ensure that your linker can find the Boost libraries. You do that with appropriate LIBS options in your PRO file; probably a single "-L" option and one or more "-l" options. The exact details will depend on where you have things installed and which Boost libraries are required.

olekhanchai
19th April 2012, 03:16
Hello ChrisW67,

I still not yet done on QxOrm. I'm sure about my library and include file are correct.
Because I can build and run example program with boost library.
Then I build QxOrm everything is done too. But I got the new problem like this :

debug/drug.o: In function `IxClass':
c:/Qt/2010.05/qt/include/QxRegister/IxClass.h:80: undefined reference to `vtable for qx::IxClass'
debug/drug.o:c:/Qt/2010.05/qt/include/QxTraits/get_sql_type.h:185: undefined reference to `qx::trait::detail::get_sql_type_by_class_name(cha r const*, char const*)'
debug/drug.o:c:/Qt/2010.05/qt/include/QxTraits/get_sql_type.h:196: undefined reference to `qx::trait::detail::get_sql_type_by_class_name(cha r const*, char const*)'
debug/drug.o: In function `QxClass':
c:/Qt/2010.05/qt/include/../../inl/QxRegister/QxClass.inl:178: undefined reference to `qx::IxClass::~IxClass()'
debug/drug.o: In function `QxCollection':
c:/Qt/2010.05/qt/include/../../inl/QxCollection/QxCollection.inl:30: undefined reference to `qx::IxCollection::~IxCollection()'
debug/drug.o: In function `~QxCollection':
c:/Qt/2010.05/qt/include/../../inl/QxCollection/QxCollection.inl:41: undefined reference to `qx::IxCollection::~IxCollection()'
c:/Qt/2010.05/qt/include/../../inl/QxCollection/QxCollection.inl:41: undefined reference to `qx::IxCollection::~IxCollection()'
c:/Qt/2010.05/qt/include/../../inl/QxCollection/QxCollection.inl:41: undefined reference to `qx::IxCollection::~IxCollection()'
c:/Qt/2010.05/qt/include/../../inl/QxCollection/QxCollection.inl:41: undefined reference to `qx::IxCollection::~IxCollection()'
.
.
.

I see underline error on QX_DLL_EXPORT seem like the same problem in the first time that I ask you.
What should I do next?

Regards,
Ole.

olekhanchai
23rd July 2012, 06:36
I have done on boost version 1.43
Thanks for answer me.