Grantlee
-
Hi there,
has anybody experience compiling with Grantlee on Ubuntu?
libgrantlee-dev is installed and auto-completion in QtCreator works fine, however I do not manage to get the example to build:#include <grantlee_core.h> #include <grantlee_templates.h> #include <grantlee/engine.h> #include <grantlee/template.h> #include <grantlee/context.h> #include <grantlee/variable.h> int main(int argc, char *argv[]) { Grantlee::Engine *engine = new Grantlee::Engine( 0 ); Grantlee::Template t = engine->newTemplate("My name is {{ name }}.", "my_template_name"); QVariantHash mapping; mapping.insert("name", "Grainne"); Grantlee::Context c(mapping); t->render(&c); // Returns "My name is Grainne." mapping.insert("name", "Henry"); c = Grantlee::Context(mapping); qDebug() << t->render(&c); // Returns "My name is Henry."
qmake && make results in:
undefined reference to `Grantlee::Engine::Engine(QObject*)'
and many other undefinded-reference-errors, as I've missed some includes.Any ideas?
Thanks in advance -
@Monster_Inc said:
Hi and welcome
Since it is a extern lib, I assume you must
add it to the .pro file
something like
LIBS += -L/path/tolib -lgrantleeoften the L part is
/usr/local/lib
LIBS += -L/usr/local/lib -lgrantlee
but should point to where the lib is.If its not linking errors, you get you might need to add the include
path to the pro file alsoHEADERS += mainwindow.h
path to folder with grantlee