c++ - Error linking discount library with Qt -
c++ - Error linking discount library with Qt -
i’m working on project uses discount library. http://www.pell.portland.or.us/~orc/code/discount/ installed library on machine , included:
#include <mkdio.h> and have piece of code:
mmiot* document = 0; char* result; qstring sourcemarkdown(markdown); if (!sourcemarkdown.endswith('\n')) sourcemarkdown.append('\n'); qbytearray info = sourcemarkdown.toutf8(); document = mkd_string(data,data.length(),mkd_nopants); mkd_compile(document,mkd_nopants); mkd_document(document,&result); qstring renderedhtml = qstring::fromutf8(result); homecoming renderedhtml; usualy utilize “-lmarkdown” flag compile (for discount shared library). in qt dont know how. tried
qmake_lflags += -lmarkdown and
unix|win32: libs += -lmarkdown but didn’t work. error messages:
undefined reference `mkd_string(char const*, int, unsigned int)' undefined reference `mkd_compile(void*, unsigned int)' etc...
any help?
it looks authors of markdown library did not consider c++ users yourself.
step 1: verify libmarkdown exports symbols looking for:
nm /path/to/libmarkdown.{a,so} | grep 'mkd_string' if see like
0x123456 t mkd_string my guess correct. if see instead:
0x123456 t _z10mkd_stringpkcij my guess wrong.
step 2: if guess correct, you'll need modify way #include <mkdio.h> this:
extern "c" { #include <mkdio.h> } you may wish contact developers of library , allow them know can prepare problem pretty putting equivalent code mkdio.h itself.
p.s. more info on c++ name mangling here.
c++ qt shared-libraries discount
Comments
Post a Comment