[odb-users] Preserving schema data in Visual Studio Static Library

Matthews, Thomas tmatthews at appliedmedical.com
Wed May 6 16:17:26 EDT 2015

I'm using Visual Studio 2010 and Visual Studio 2008 to build a static library containing my ODB classes.

When execute my program, I get the following error message for every ODB object:
Uncaught exception of type struct odb::unknown_schema - unknown database schema.

There are articles on how to fix this on Linux or with Mingw (GCC).
The only information I found related to Visual Studio is to add this text to the odb command line:
--cxx-epilogue 'extern "C" int object_phony_symbol = 0;'

The problem is I get "C : error : unable to open in read mode".  The marks are single quotes around the C++ statement.  The error also occurs when using the back-tick marks as well.

The discussion text also has a link to 2.2.0 but I'm using version 2.3.0.

Does anybody have a *working* solution for telling Visual Studio not to drop the schema data when creating a static library?

Due to the size of my project, I really prefer not to have all the cxx files in one module.

What is your solution to this issue?

I'm using ODB version 2.3.0.

The odb command line is in the property page of the hpp file, under the Custom Build Tool - Command Line.
Here's an example:
odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient -d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query --generate-schema --schema-format separate  --cxx-epilogue `extern "C" int category_phony_symbol = 0;`  c:\menuplan\src\ingredient\ing_odb_category.hpp


More information about the odb-users mailing list