We have a number of people that are successfully using Qt and MingW. What exactly is the error and what line does it happen on?
Hello,
I have to use the TurboActivate lib with QtCreator and MinGW as compiler and Win as OS, but include of the library does not work. Can you help me please to solve tis problem. There must be an error in the #defines.
Regards,jp
We have a number of people that are successfully using Qt and MingW. What exactly is the error and what line does it happen on?
I'm using MinGW 4.8 32bit as compliler, Qt 5.1.1 and Win7 as OS.
I included TurboActivate in my .pro file as following:
INCLUDEPATH += D:\\Qt\\packages\\TurboActivate\\API\\C
LIBS += -LD:\\Qt\\packages\\TurboActivate\\API\\C\\x86 \ -lTurboActivate \
And i'm getting the error messages:
Error (TurboActivate.h l35):expected unqualified-id before string constant #define TURBOACTIVATE_API extern "C" __declspec(dllimport)Error (TurboActivate.h l51): in definition of macro 'TA_DEPRECATED' #define TA_DEPRECATED(func) __declspec(deprecated) funcError (TurboActivate.h l663): in expansion of macro 'TURBOACTIVATE_API' TA_DEPRECATED(TURBOACTIVATE_API HRESULT TA_CC GracePeriodDaysRemaining(STRCTYPE versionGUID, uint32_t * DaysRemaining));
I think there have some changes to be made in the TurboActivate.h. I tried to replace line 35 by line 58, but without success. So, I hope that you could please tell me how to modify the TurboActivate.h to use it with Qt, MinGW and WinOS, because I'm using your great service for more than a year now and everything else is perfect!!
It sounds like MingW doesn't implement all of the Microsoft compiler features. So you'll have to replace this line:
#define TA_DEPRECATED(func) __declspec(deprecated) func
With this:
#define TA_DEPRECATED(func) func
Also, you might be passing compiler or linker options that are throwing a wrench into the process. You'll likely have to replace this line:
#define TURBOACTIVATE_API extern "C" __declspec(dllimport)
With this:
#define TURBOACTIVATE_API extern "C"
After replacing the lines in the TurboActivate.h, the is noch error while compiling my app, but in debugging mode the application crashes after compiling and in release mode, it's not possible to use any function from your library.Is it possible to provide a TurboActivate.h and an excample QtCreator .pro file for use with MinGW on Windows and MacOS, possibly from a user who got it working?
application crashes after compiling
What's the crash? Specifics are needed.
I see you're linking the TurboActivate.lib, but are you actually including the TurboActivate.dll in the same directory as your application binary? (Also, don't use the static libraries -- not with MinGW, at least).
Ok,
I got it working now by the both replacements in the TurboActivate.h and by putting the needed .dll in the correct folder.I also hat to replace
typedef LPWSTR STRTYPE typedef LPCWSTR STRCTYPE
by
typedef char* STRTYPE; typedef const char* STRCTYPE;
The last problem I have now is, that I get a GUID-error (hr=7) every time I try to run your excample.c fuction, but I put the correct TurboActivate.dat file next to the .dll and I replaced the correct GUID in the code by
#define TA_GUID _T("18324776654b3946fc44a5f3.49035205")
Is it probably a datatype error or something like this?
I also hat to replace
typedef LPWSTR STRTYPEtypedef LPCWSTR STRCTYPE
by
typedef char* STRTYPE;typedef const char* STRCTYPE;
Don't do that. That won't work. TurboActivate uses Unicode strings (wide character strings). If you use ANSI strings (char*) then this will produce garbage and TurboActivate will just say, "nope that's wrong: TA_FAIL".
I'm assuming you did this because you couldn't get LPWSTR / LPCWSTR to compile, correct? Make sure you're including the correct headers in your applications. We include the <windows.h>, which should include these definitions. Also, make sure your app is being compiled as "Unicode" on Windows. Also, including <TCHAR.h> might fix this.
Is it probably a datatype error or something like this?
Yep, like I explained above. You're using a ANSI single-byte string (char *) when TurboActivate expects a double-byte Unicode string (wchar *). Thus you're passing garbage to TurboActivate.