Problem with Compiling QxORM Test Project

Forum for posting problems using QxOrm library

Problem with Compiling QxORM Test Project

Postby oxormnewbie » Fri Feb 17, 2012 9:07 am

Hello OxOrm Community,
i am interested about OxOrm Library and wanted to try an Example.

I`ve oriented at the Quick-Start Example from the Webpage.

That is my Test-Class:

#ifndef _CLASS_STAND_H_
#define _CLASS_STAND_H_

class Stand
{
public:
long id;
QString caption;

Stand() : id(0) { ; }
virtual ~Stand() { ; }
};

QX_REGISTER_HPP_MY_TEST_EXE(Stand, qx::trait::no_base_class_defined, 1)

/* This macro is necessary to register 'Stand' class in QxOrm context */
/* param 1 : the current class to register => 'drug' */
/* param 2 : the base class, if no base class, use the qx trait => 'qx::trait::no_base_class_defined' */
/* param 3 : the class version used by serialization to provide 'ascendant compatibility' */

#endif // _CLASS_STAND_H_

And the Defination .cpp File belonging to the class:

#include "StdAfx.h"
#include "precompiled.h" // Precompiled-header with '#include <QxOrm.h>' and '#include "export.h"'
#include "stand.h" // Class definition 'drug'
#include <QxMemLeak.h> // Automatic memory leak detection

QX_REGISTER_CPP_MY_TEST_EXE(Stand) // This macro is necessary to register 'drug' class in QxOrm context

namespace qx {
template <> void register_class(QxClass<Stand> & t)
{
t.id(& Stand::id, "id"); // Register 'Stand::id' <=> primary key in your database
t.data(& Stand::caption, "caption", 1); // Register 'Stand::name' property with key 'name' and version '1'
}}

I use Visual Studio 2008.

When i want to compile my Example, the Compiler says:
error C2259: 'qx::trait::no_base_class_defined': Instanz von abstrakter Klasse kann nicht erstellt werden aufgrund folgender Member:
"void qx::trait::no_base_class_defined::dummy(void)": ist abstrakt
D:\QxOrm\include\QxTraits/get_base_class.h(50): Siehe Deklaration von 'qx::trait::no_base_class_defined::dummy'

When i modify the Macro-Names QX_REGISTER_CPP_MY_TEST_EXE and QX_REGISTER_HPP_MY_TEST_EXE to QX_REGISTER_CPP and QX_REGISTER_HPP, the Project will be compiled, but the Linker says:
error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""protected: __thiscall boost::archive::detail::basic_oserializer::basic_oserializer(class boost::serialization::extended_type_info const &)" (??0basic_oserializer@detail@archive@boost@@IAE@ABVextended_type_info@serialization@3@@Z)" in Funktion ""public: __thiscall boost::archive::detail::oserializer<class boost::archive::xml_oarchive,class QObject>::oserializer<class boost::archive::xml_oarchive,class QObject>(void)" (??0?$oserializer@Vxml_oarchive@archive@boost@@VQObject@@@detail@archive@boost@@QAE@XZ)".

How must i modify the Macro name or my class that the Project will be compiled and QxORM can be used?

Many Thanks!
oxormnewbie
 
Posts: 6
Joined: Fri Feb 17, 2012 8:59 am

Re: Problem with Compiling QxORM Test Project

Postby QxOrm admin » Fri Feb 17, 2012 10:13 am

Hi and welcome on this forum ;) ,

Before starting your own project, I recommend to try all samples into "./test/" directory of QxOrm library package.
For Visual Studio 2008, there is a solution *.sln for each samples, so you can test all of them very quickly.
Just one thing to do before : modify your QxOrm.pri file to set your boost directory (more details here : http://www.qxorm.com/qxorm_en/faq.html#faq_30).
If you can build and execute all of them without any problem, you will be sure that your environment is installed correctly : Qt, boost and QxOrm.

Then, I recommend to read at least the first tutorial :
http://www.qxorm.com/qxorm_en/tutorial.html
It explains how to create your project : *.pro file, precompiled header, macros QX_REGISTER_HPP_MY_TEST_EXE and QX_REGISTER_CPP_MY_TEST_EXE, etc...

Anyway, your code seems correct, but I think you have a problem with QX_REGISTER_HPP_MY_TEST_EXE and QX_REGISTER_CPP_MY_TEST_EXE.
More details here about those macros : http://www.qxorm.com/qxorm_en/tutorial.html#tuto_4
QxOrm admin
 

Re: Problem with Compiling QxORM Test Project

Postby oxormnewbie » Fri Feb 17, 2012 12:05 pm

Thanks for the fast answer. It works!

I have another question too: Is there a tutorial or a page at the dokumentation where is explaind how to send more complex queries, for example with more than one table an relations?

Many thanks
oxormnewbie
 
Posts: 6
Joined: Fri Feb 17, 2012 8:59 am

Re: Problem with Compiling QxORM Test Project

Postby QxOrm admin » Fri Feb 17, 2012 12:51 pm

For queries, there is qx::QxSqlQuery class (or qx_query), you can find some documentation here :
http://www.qxorm.com/qxorm_en/faq.html#faq_210

And the class definition here :
http://www.qxorm.com/doxygen/html/class ... query.html
QxOrm admin
 


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 1 guest