Compiling Sample.cpp under Linux with clang

I tried compiling Sample.cpp with clang. The LexActivator.h file was present in the same directory, and I know it was being loaded because if I changed the file name in the #include line I got a “file not found” error message. But clang is getting errors compiling Sample.cpp.

clang --version
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

clang Sample.cpp
Sample.cpp:16:11: error: no matching function for call to ‘SetProductFile’
status = SetProductFile(L"Product.dat");
^~~~~~~~~~~~~~
./LexActivator.h:85:32: note: candidate function not viable: no known conversion from
‘const wchar_t [12]’ to ‘CSTRTYPE’ (aka ‘const char *’) for 1st argument
LEXACTIVATOR_API HRESULT LA_CC SetProductFile(CSTRTYPE filePath);
^
Sample.cpp:22:11: error: no matching function for call to ‘SetVersionGUID’
status = SetVersionGUID(L"59A44CE9-5415-8CF3-BD54-EA73A64E9A1B", LA_USER);
^~~~~~~~~~~~~~
./LexActivator.h:110:32: note: candidate function not viable: no known conversion from
‘const wchar_t [37]’ to ‘CSTRTYPE’ (aka ‘const char *’) for 1st argument
LEXACTIVATOR_API HRESULT LA_CC SetVersionGUID(CSTRTYPE versionGUID, uint32_t flags);
^
Sample.cpp:40:17: error: no matching function for call to ‘SetTrialKey’
trialStatus = SetTrialKey(L"CCEAF69B-144EDE48-B763AE2F-A0957C93-98827434");
^~~~~~~~~~~
./LexActivator.h:331:32: note: candidate function not viable: no known conversion from
‘const wchar_t [45]’ to ‘CSTRTYPE’ (aka ‘const char *’) for 1st argument
LEXACTIVATOR_API HRESULT LA_CC SetTrialKey(CSTRTYPE trialKey);
^
Sample.cpp:57:13: error: no matching function for call to ‘SetProductKey’
status = SetProductKey(L"986D8-DE8AF-C2B37-50BF5-03EA1");
^~~~~~~~~~~~~
./LexActivator.h:123:32: note: candidate function not viable: no known conversion from
‘const wchar_t [30]’ to ‘CSTRTYPE’ (aka ‘const char *’) for 1st argument
LEXACTIVATOR_API HRESULT LA_CC SetProductKey(CSTRTYPE productKey);
^
Sample.cpp:63:4: error: no matching function for call to ‘SetExtraActivationData’
SetExtraActivationData(L"sample data");
^~~~~~~~~~~~~~~~~~~~~~
./LexActivator.h:143:32: note: candidate function not viable: no known conversion from
‘const wchar_t [12]’ to ‘CSTRTYPE’ (aka ‘const char *’) for 1st argument
LEXACTIVATOR_API HRESULT LA_CC SetExtraActivationData(CSTRTYPE extraData);
^
5 errors generated.

Hi,

Remove “L” (Windows specific) from the set functions:

status = SetProductFile(L"Product.dat");

should be

status = SetProductFile(“Product.dat”);