License Activation Error

Hi,

I am trying to activate the trial licence of windows 10 but I am facing the following errors :

“error C 2065: ‘intrusive_ptr’: undeclared identifier”

“error C 2065: ‘License’: undeclared identifier”

I just add the following two lines to activate the license as suggested in the documentation:

 intrusive_ptr<License> license = new License();

license->SetLicense(new String("Aspose.Barocde.lic"));

Please find the attached example code to have a better idea regarding my issue.

main.zip (1.4 KB)

@RArdeshna,

Are you not using common/standard Visual Studio C++ project? What is Platform toolset set/configured for your project? Could you please provide a complete standalone VS.NET sample project, zip the project and post us, we will check it soon.

Hi Amjad,

Thanks for the reply. I tried building and running the example code and that works fine.

when I try to add the two lines for activating the licence, I am facing the errors.

I am building the program using the command : cmake -G “Visual Studio Code 16 2019” - A x64

Do i need to use a different approach?

Do you mean, you only find the issue for the lines of code when instantiating license while other code segments are working fine? By the way, will it work if you do not use CMake command lines and use Visual Studio (e.g., 2019/2022) to create and build C++ project with Aspose.BarCode for C++?

Hi Amjad,

Yes, I can build the example code (without instantiating the license) using CMake.

I tried creating the solution with Visual studio and tried building it. But, I faced the same errors. I am attaching the solution project under this link : Project1 - Google Drive. Please have a look at it and suggest necessary modifications.

@RArdeshna,

Thanks for sharing the sample.

I tested the sample and found the issue you mentioned. I guess this is something to do with adding include file regarding “License.h” header from “Licensing” sub folder. I tried adding the following line in the Source.cpp but to no avail:

#include <Licensing/License.h>
....

I can define the variable like following in the main method:

Aspose::BarCode::License license;

but it still gives compile time error when I tried instantiating license object using the line:

Aspose::BarCode::License license = new License();

I have logged a ticket with an id “BARCODECPP-490” for your issue. We will evaluate it thoroughly and sort it out soon.

Hello.
You should add corresponded include as was mentioned:

#include <Licensing/License.h>

And then you can use something like that in your code:

auto license = System::MakeObject<License>();
license->SetLicense(u"c:\\temp\\Aspose.BarCode.CPP.lic");