error registering my class

Forum for posting problems using QxOrm library

error registering my class

Postby eyalk5 » Wed Jul 07, 2010 1:16 pm

hello,

I need a little help.

I encounter 3 errors if i try to register my class :

the errors refer to QX_REGISTER_CPP_IMPORT_DLL(my_class)

syntax error : 'string'
syntax error : missing ; before qx:QxFactory<T> with [ T= my_class]
missing type specifier - int assumed...

qt version 4.5.2
boost 1.40
I use cl to compile it.

I did just like the example, QX_REGISTER_HPP_IMPORT_DLL on h file , and wrote template <> void register_class(QxClass<my_class>& t)
do you know what could be the reason for these errors?

thanks.
eyalk5
 

Re: error registering my class

Postby QxOrm admin » Sat Jul 10, 2010 8:57 am

Hi,

Did you try to compile samples in "./test/" directory ?

There is 2 samples :
1- qxBlog : this is the source code of website tutorial
2- dll1, dll2, and exe : this is to show how to use QxOrm with shared libraries (.dll under Windows and .so under linux)

This 2 samples MUST compile and execute correctly to verify your installation (boost, Qt and QxOrm).

-----------------------------

For your problem and macro "QX_REGISTER_CPP_IMPORT_DLL", this is the point 4 of website tutorial :

You MUST NOT directly use "QX_REGISTER_CPP_IMPORT_DLL" or "QX_REGISTER_CPP_EXPORT_DLL" macro :
This is the same system when you develop with dll under Windows => you MUST define your own macro to export (your dll is compiling) or import (your dll is using) class or function.

So to start a project with QxOrm, the first thing to do is to create 2 files :
1- a "export.h" file to redefine your own macro
2- a "precompiled.h" file to reduce compilation time

The website tutorial explains in french how to use QxOrm (i will write an english traduction...)
QxOrm admin
 

Re: error registering my class

Postby QxOrm admin » Sat Jul 10, 2010 9:03 am

If you have always your compilation problem, can you post your file ?

1- export.h
2- precompiled.h
3- my_class.h
4- my_class.cpp
5- main.cpp

Thank you for testing our library...
QxOrm admin
 

Re: error registering my class

Postby Ben » Thu Feb 03, 2011 12:53 pm

I have identical build errors.

Test solution is building correctly.
I am using VS 2008 / Qt 4.6.2 / Boost 1.42

I'll try to extract a code base reproducing these errors.

Cordialement,

Ben
Ben
 

Re: error registering my class

Postby QxOrm admin » Thu Feb 03, 2011 3:06 pm

Hi,

You can send me your source code at this address : contact@qxorm.com.
I think it is a problem with your 'export.h' file (or similar for your project)...
QxOrm admin
 

Re: error registering my class

Postby Ben » Mon Feb 07, 2011 9:59 am

I found it:

The registering MACROS use BOOST_CLASS_EXPORT_GUID which need
#include <boost/serialization/export.hpp>

This include is usually provided by #include <QxMemLeak.h>
Ben
 

Re: error registering my class

Postby QxOrm admin » Mon Feb 07, 2011 11:51 am

You are right : you need to include '#include <boost/serialization/export.hpp>' in each cpp files if you don't use '#include <QxMemLeak.h>'.
This is due to a precompiled header bug and boost serialization export file (at least with visual studio compiler).
Maybe boost team has resolved the problem (???) : in this case, you can add #include <boost/serialization/export.hpp> in your precompiled header file.

Thanks to post the solution ;)
QxOrm admin
 


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 7 guests