KDABLabs / sqlate

60 stars 16 forks source link

Getting started #9

Open matpen opened 7 years ago

matpen commented 7 years ago

I am trying to get started with the library, and I successfully built it using the provided instructions.

However, I am having issues when trying to build a simple test project. Here is my .pro file:

QT += core gui widgets sql
CONFIG += c++14

TARGET = test_sqlate
TEMPLATE = app

INCLUDEPATH += /opt/sqlate/include
LIBS += -L/opt/sqlate/lib -lsqlate

SOURCES += main.cpp

And here is my main.cpp:

#include <QApplication>
#include <SqlSchema.h>
#include <Sql.h>

//copied from README.md
TABLE( Presenters) {
    SQL_NAME( "presenters" );
    COLUMN( name, QString, NotNull );
    COLUMN( age, int, NotNull );
    COLUMN( company, QString);
    typedef boost::mpl::vector<nameType, ageType, companyType> columns;
};

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    return 0;
}

I am getting the error no match for operator% (operand types are QLatin1Literal and QString), along with others. Is there anything I am missing? I am using Qt 5.7 with GCC 5.4.

amantia commented 7 years ago

Can you please paste the full error message you get?

An idea would be to build the project with the same defines as sqlate is built: DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_BYTEARRAY

Optionally add also the following ones: BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS QT_STRICT_ITERATORS QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS .

matpen commented 7 years ago

Hi amantia,

thank you for your reply. I pasted the full compiler output here.

Then I added the lines

DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_BYTEARRAY
DEFINES += BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS QT_STRICT_ITERATORS QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS

to the .pro file, and rebuilt. The first error seems to go away, but I get a bunch of other template errors: output here.