link .a lib -textmagic.a
-
Hi,
Do you have a C++ part in your QtQuick project ? If so, use it the same way as any other lib.
-
@LeLev It seems named wrong. In mingw it should be something like
libtextmagic.a
and you would include it with-l textmagic
. That's command line though you would do it a bit differently in qmake or cmake. If you share your build system I can tell you the line you would need in your project. -
@SGaist @ambershark thx for reply,
@ambershark said in link .a lib -textmagic.a:
It seems named wrong
my bad, it is actually named libtextmagic.a
@ambershark said in link .a lib -textmagic.a:
. If you share your build system I can tell you the line you would need in your project
How do i share my build sestem please ?
-
@LeLev What do you use to build? Qmake? That's my guess... in which case share your .pro file here. If it's cmake share your CMakeLists.txt file here.
-
@LeLev I'll just share this too since it's what you need... if you use qmake you will add a line (or append to it if you have) like this:
LIBS += -L/path/to/your/lib -ltextmagic
The
/path/to/your/lib
should be the path to the folder that has libtextmagic.a in it. It's best not to hard code an absolute path though. Otherwise your build won't work on a different system. -
@ambershark thank you for you time, i plan to use qmake for my application but for the moment, this is an empty ququick application. Im just trying to include libtextmagic.a
for build static textmagic i used make.
One last question, is textmagic.a 'standalone' or it has to be located in the directory of its sources ?
-
i am having hard time with this..
now the lib is included successifuly
but if i include textmagic.h//main.cpp #include "../../MAGIC/include/textmagic.h" Textmagic tm;
error : json/json.h: No such file or directory
the error comes from file
MAGIC\include\entity\base.h#include <json/json.h> // error here
i can correct this include line it should be #include "../jsoncpp/json/json.h"
and if i correct this then same error will be in the next file and so on .. im probably doing somthing wrong
-
I still have the same error
error : json/json.h: No such file or directory
Error comes from file
MAGIC\include\entity\base.h
#include <json/json.h> // error here, there is no dir called json inside entity, the json.h the correcte location is "../jsoncpp/json/json.h"
but if i do #include "../jsoncpp/json/json.h"
i will have lot of erros and this output :
Makefile.Release:718: warning: overriding recipe for target 'release/testmagic.o' Makefile.Release:555: warning: ignoring old recipe for target 'release/testmagic.o' g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release/steasyweb_.exe object_script.steasyweb_.Release -lmingw32 -LC:/Qt/5.10.0/mingw53_32/lib C:/Qt/5.10.0/mingw53_32/lib/libqtmain.a -LC:/utils/my_sql/my_sql/lib -LC:/utils/postgresql/pgsql/lib -lshell32 C:/Qt/5.10.0/mingw53_32/lib/libQt5Core.a -LC:/Users/Lev/Documents/MAGIC/lib -ltextmagic C:/Qt/5.10.0/mingw53_32/lib/libQt5Quick.a C:/Qt/5.10.0/mingw53_32/lib/libQt5Gui.a C:/Qt/5.10.0/mingw53_32/lib/libQt5Qml.a C:/Qt/5.10.0/mingw53_32/lib/libQt5Network.a C:/Qt/5.10.0/mingw53_32/lib/libQt5Core.a ./release/testmagic.o:testmagic.cpp:(.text+0x10): multiple definition of `TestMagic::TestMagic(QObject*)' ./release/testmagic.o:testmagic.cpp:(.text+0x10): first defined here ./release/testmagic.o:testmagic.cpp:(.text+0x10): multiple definition of `TestMagic::TestMagic(QObject*)' ./release/testmagic.o:testmagic.cpp:(.text+0x10): first defined here ./release/restclient.o:restclient.cpp:(.text+0x1ed): undefined reference to `_imp__curl_slist_append' ./release/restclient.o:restclient.cpp:(.text+0x7ec): undefined reference to `_imp__curl_easy_init' ./release/restclient.o:restclient.cpp:(.text+0x840): undefined reference to `_imp__curl_easy_setopt' ./release/restclient.o:restclient.cpp:(.text+0x889): undefined reference to `_imp__curl_easy_perform' ./release/restclient.o:restclient.cpp:(.text+0x8a3): undefined reference to `_imp__curl_easy_getinfo' ./release/restclient.o:restclient.cpp:(.text+0x8ac): undefined reference to `_imp__curl_easy_cleanup' ./release/restclient.o:restclient.cpp:(.text+0x8b5): undefined reference to `_imp__curl_slist_free_all' ./release/restclient.o:restclient.cpp:(.text+0xa87): undefined reference to `_imp__curl_global_init' ./release/restclient.o:restclient.cpp:(.text+0xabb): undefined reference to `_imp__curl_easy_init' ./release/restclient.o:restclient.cpp:(.text+0xad9): undefined reference to `_imp__curl_easy_setopt' ./release/restclient.o:restclient.cpp:(.text+0xb92): undefined reference to `_imp__curl_easy_perform' ./release/restclient.o:restclient.cpp:(.text+0xba9): undefined reference to `_imp__curl_easy_getinfo' ./release/restclient.o:restclient.cpp:(.text+0xbb2): undefined reference to `_imp__curl_easy_cleanup' ./release/restclient.o:restclient.cpp:(.text+0xbbe): undefined reference to `_imp__curl_slist_free_all' ./release/restclient.o:restclient.cpp:(.text+0xbc4): undefined reference to `_imp__curl_global_cleanup' ./release/restclient.o:restclient.cpp:(.text+0xcd3): undefined reference to `_imp__curl_global_init' ./release/restclient.o:restclient.cpp:(.text+0xd07): undefined reference to `_imp__curl_easy_init' ./release/restclient.o:restclient.cpp:(.text+0xd25): undefined reference to `_imp__curl_easy_setopt' ./release/restclient.o:restclient.cpp:(.text+0xdf4): undefined reference to `_imp__curl_easy_perform' ./release/restclient.o:restclient.cpp:(.text+0xe0b): undefined reference to `_imp__curl_easy_getinfo' ./release/restclient.o:restclient.cpp:(.text+0xe14): undefined reference to `_imp__curl_easy_cleanup' ./release/restclient.o:restclient.cpp:(.text+0xe20): undefined reference to `_imp__curl_slist_free_all' ./release/restclient.o:restclient.cpp:(.text+0xe26): undefined reference to `_imp__curl_global_cleanup' ./release/restclient.o:restclient.cpp:(.text+0xf4e): undefined reference to `_imp__curl_easy_init' ./release/restclient.o:restclient.cpp:(.text+0xf76): undefined reference to `_imp__curl_easy_setopt' ./release/restclient.o:restclient.cpp:(.text+0x1028): undefined reference to `_imp__curl_easy_perform' ./release/restclient.o:restclient.cpp:(.text+0x103d): undefined reference to `_imp__curl_easy_getinfo' ./release/restclient.o:restclient.cpp:(.text+0x1046): undefined reference to `_imp__curl_easy_cleanup' collect2.exe: error: ld returned 1 exit status mingw32-make[1]: *** [release/steasyweb_.exe] Error 1
-
@LeLev This sounds like you are trying to include another library, something json based.
Here's a better way to do this... can you share what you're trying to build? This sounds like it's someone else's project with those 3rd party libs.
If it's an open source project or something you are trying to build share that and we can help you. If it's closed source or your own stuff, give us at least the qmake and a directory listing would be nice (something like
find .
). -
@LeLev said in link .a lib -textmagic.a:
./release/testmagic.o:testmagic.cpp:(.text+0x10): multiple definition of
TestMagic::TestMagic(QObject*)' ./release/testmagic.o:testmagic.cpp:(.text+0x10): first defined here ./release/testmagic.o:testmagic.cpp:(.text+0x10): multiple definition of
TestMagic::TestMagic(QObject*)'
./release/testmagic.o:testmagic.cpp:(.text+0x10): first defined hereThese errors imply that you have linked the testmagic.o object multiple times, both via the .o and the .a would be my guess. Seeing the qmake would help here.
./release/restclient.o:restclient.cpp:(.text+0x1ed): undefined reference to
_imp__curl_slist_append' ./release/restclient.o:restclient.cpp:(.text+0x7ec): undefined reference to
_imp__curl_easy_init'These mean you aren't linking to curl. That's yet another dependency you will have to install and link the LIB/INCLUDE paths to it's location.
-
@LeLev: Why had this topic been deleted? It should have rather been declared as SOLVED.
The answers here may also help other users in future.
Regards
-
@aha_1980 I was stuck, and had no response for 3 days, so i just used another lib...
Thank you @ambershark for your help, i just saw your answers. This is the project i was trying to build :
https://github.com/textmagic/textmagic-rest-cpp -
@aha_1980 So i was trying to use text magic c++ lib to send an SMS from my app,
but finnaly i used SMSAPI https://www.smsapi.com/fr, it offers possibility to send a SMS only by doing a post or get request like :https://api.smsapi.com/sms.do?to=0643566333&message=helloWorld
of cours you have to subscribe/paye (~5cts / SMS)