0

I'm trying use ODB in my program to save a class that contains CString type (a MFC variable type). When I compile the include file with ODB, it tell me the 'CString' does not name a type.

There is 2 ways I think can solve it. I tried but failed. 1、Let ODB support the CString type I write a CString-traits.hxx reference the qt example and this web (https://www.codesynthesis.com/~boris/blog/2012/07/18/custom-database-to-cxx-type-mapping-in-odb/),when I compile with ODB, the compiler want the CString support include file. I give the include file path, but the compiler want more include file that from the CString include file, and it appears more unsupport type. I think there must be sth wrong because it's so inconvenient.

2、Let ODB compiler ignore the 'CString' word I add the '#pragma db transient' before the CString, like below:

#pragma db transient
    CString name;

but the odb compiler also tell me the CString not name a type.

After all, my question is: 1、How can ODB support CString? 2、How can ODB compiler ignore particular sentence, such as sentence contains 'CString'?

Thinks

IInspectable
  • 46,945
  • 8
  • 85
  • 181
kexuetutu
  • 1
  • 1
  • `CString` is not a type. It's a type alias. You might have better luck using the explicit class template instantiations `CStringA` and `CStringW`. – IInspectable Oct 30 '18 at 09:40
  • Thank you IInspectable. I have tried CStringA, but ODB always search the include files (to support CStringA) and request new include or variable types. I don't think ODB is so inconvenient, so there must be sth wrong in my code. – kexuetutu Oct 30 '18 at 10:55

0 Answers0