[odb-users] Using ODB with qmake on Windows

Jordan J. Neuhart jneuhart at tlirr.com
Thu Oct 25 11:27:20 EDT 2012


I just realized that I forgot to answer your question.  I am using qmake
as part of QtCreator and my target toolchain is VC++, and I am using Qt
4.8.3.  I am also using sqlite as my database.  I followed the
directions on the link you provided and gave your suggestion a try,
modifying for sqlite of course.  When I build the project in QtCreator,
I keep getting the following error:

jom 1.0.6 - empower your cores

Error: Invalid macro invocation found in
C:\Users\jjn\test\Makefile.Release line 102 command failed with exit
code 2
09:08:59: The process "C:\QtSDK\QtCreator\bin\jom.exe" exited with code
Error while building project test (target: Desktop) When executing build
step 'Make'

I have attached my .pro file.  The problem seems to stem from the line:

odb.input = ODB_FILES

For some reason, the build process is interpreting ODB_FILES as a macro.
If I change the line to:

odb.input = $$ODB_FILES

Then the build gets a little farther, but stops with this error:

Error: dependent 'employee-odb.cxx' does not exist.
command failed with exit code 2
09:12:14: The process "C:\QtSDK\QtCreator\bin\jom.exe" exited with code
Error while building project test (target: Desktop) When executing build
step 'Make'

Also, if I then change the line:

odbh.input = ODB_FILES


odbh.input = $$ODB_FILES

then I get a little farther, but still fail with the following VC++
compiler error:

C:\Users\jjn\test\driver.cxx:15: error: C1083: Cannot open include file:
'employee-odb.hxx': No such file or directory

So it seems that the odb header file is not getting compiled for some
reason.  The odb compiler is in my PATH variable, and I have the
"odb-sqlite.lib", "odb-qt.lib", and "odb.lib" libraries sitting at the
same level as my .hxx and .cxx files in the folder hierarchy.  I think I
have all of the headers in my INCLUDEPATH as well.

Any suggestions for what to try next?  Also, what is the purpose of the
'odbh' extra compiler that just issues the 'rem' command?



-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com]
Sent: Thursday, October 25, 2012 4:08 AM
To: Jordan J. Neuhart
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] Using ODB with qmake on Windows

Hi Jordan,

Jordan J. Neuhart <jneuhart at tlirr.com> writes:

> I'm new to odb and I would like to use it on a Qt project that I am 
> working on.  I'd like to be able to run the odb compiler as a 
> pre-compilation step in qmake, but I can't seem to get it to work.
> Does anyone have any experience with this and would be willing to 
> share their solution?

Are you using qmake as part of the QtCreator? What is your target
toolchain (i.e., VC++ or MinGW)?

There is a page on the Wiki that describes how to setup ODB with
QtCreator on Linux:


It includes a section of qmake .pro file that contains the rules for
compiling headers with ODB. I think it should work on Windows with
possibly two modifications:

1. The 'odb.commands = ...' line assumes that the ODB compiler
   executable is in the PATH. If that's not the case, then you will
   need to change it to something like this:

   odb.commands = C:\odb-X.Y.Z\bin\odb.exe ...

2. The 'odbh.commands = @true' line needs to be changed to something
   equivalent for the Windows cmd shell:

   odbh.commands = rem

Can you try this and let us know if it works?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pro
Type: application/octet-stream
Size: 1745 bytes
Desc: test.pro
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20121025/5e3d82a2/test.obj

More information about the odb-users mailing list