Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Dlms With C++

Dlms with c++

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By Varun Sharma , 6 November, 2020
Forums
General discussion

Hello sir,

i have used gurux libraries and developed c# app.Now i am working on c++, i have downloaded "Gurux.DLMS.cpp-master" but i m not able to start it anyway. In visual studio its not starting giving the error
Error LNK1104 cannot open file 'Debug\GuruxDLMS.lib'

I m using codeblock ide to build c++ version.
Please guide me how can i develop in c++. I want to use GXDLMSreader type file that i use in c#.

Profile picture for user Kurumi

Kurumi

5 years 7 months ago

Hi,

Hi,

Open GuruxDLMSClientExample it will do exactly the same as C# example.
You need to build the development folder first.

BR,
Mikko

Varun Sharma

5 years 7 months ago

In reply to Hi, by Kurumi

Successfully build it in VS

Successfully build it in VS but when i run it this error shows(check image).
I have windows10 64 bit computer.

Image
Profile picture for user Kurumi

Kurumi

5 years 7 months ago

Hi,

Hi,

You have set the wrong path. You are running Win32 and set a path to Win64 version. Change that.

BR,
Mikko

Varun Sharma

5 years 7 months ago

In reply to Hi, by Kurumi

I dont understand sir,

I dont understand sir,
Its giving error when i am using win 32 in visual studio. Check below image.

Image
Profile picture for user Kurumi

Kurumi

5 years 7 months ago

Hi,

Hi,

I believe that you try to start Gurux.DLMS.library. You need to open GuruxDLMSClientExample and start that.

Varun Sharma

5 years 7 months ago

In reply to Hi, by Kurumi

After starting

After starting GuruxDLMSClientExample how can i read Instant etc. Where i have to provide the options to start communication??

Profile picture for user Kurumi

Kurumi

5 years 7 months ago

Hi,

Hi,

Gurux client example reads all the data from the meter. If you are running this from the VS, find ShowHelp method. It'll show all command-line arguments.

BR,
Mikko

Varun Sharma

5 years 7 months ago

In reply to Hi, by Kurumi

I have provided the arguments

I have provided the arguments but its showing authentication failure. And still I didn't get the idea of downloading instant profile from this code. Plz provide an example.
Can i include dlms c++ library in my new c++ project in visual studio?

Image
Profile picture for user Kurumi

Kurumi

5 years 7 months ago

Hi,

Hi,

Remove [] around your password.

You need to create a profile generic object and then read capture objects and buffer.

BR,
Mikko

Varun Sharma

5 years 7 months ago

In reply to Hi, by Kurumi

Remove [] around your

Remove [] around your password.
answer: its done and reading.

You need to create a profile generic object and then read capture objects and buffer.
Answer: Sir as c++ is new to me plz provide an example code to download instant profile.

Profile picture for user Kurumi

Kurumi

5 years 7 months ago

Hi,

Hi,

Something like this:

CGXDLMSProfileGeneric pg("LOGICAL NAME");
Read(&it, 3, str);
Read(&it, 2, str);

Check also ReadRowsByRange and ReadRowsByEntry.

BR,
Mikko

Varun Sharma

5 years 7 months ago

Started a new c++ project in

Started a new c++ project in visual studio and included all the files in that project.
After building the project these type of errors are coming. Any suggestions??

I want to start new c++ project and include c++ library to download meter. Plz help

Image
Profile picture for user Kurumi

Kurumi

5 years 7 months ago

Hi,

Hi,

Please, don't add pics like this. They are compressed and I can't see the error code.

You haven't added linker dependencies. Add those:
Debug\GuruxDLMS.lib
Ws2_32.lib

BR,
Mikko

Varun Sharma

5 years 7 months ago

In reply to Hi, by Kurumi

Added linker dependencies and

Added linker dependencies and those errors are gone.Thank You sir
Now the below line is creating error.I have copied the same code which was in dlmsclient example.
char* serialPort = "COM1";

Error (active) E0144 a value of type "const char *" cannot be used to initialize an entity of type "char *"

Error C2440 'initializing': cannot convert from 'const char [5]' to 'char *'

Profile picture for user Kurumi

Kurumi

5 years 7 months ago

Hi,

Hi,

Change to this:
const char* serialPort = "COM1";

BR,
Mikko

Varun Sharma

5 years 6 months ago

Hello sir,

Hello sir,
Now i m getting the initialization correctly.
Reading meter data with below code.
CGXDLMSProfileGeneric *obj = new CGXDLMSProfileGeneric("1.0.94.91.0.255");//Instant
obj->SetAccess(2, DLMS_ACCESS_MODE_READ);
ret = comm.Read(obj, 2,value);
I m getting ret =0 i.e success.
All methods are returning integer value.
But i need to save the data so how can i get the data or the buffer which i am reading.
if i m reading second attribute then where can i get the resulted parameters so that i can save and show them.
Thank You

Profile picture for user Kurumi

Kurumi

5 years 6 months ago

Hi,

Hi,

After you have read the value you can see the value in the object attribute.
You can use ToString-method to get all object's values as a string.
If you read attribute #2, you can get value from the Buffer property.

www.gurux.fi/Gurux.DLMS.Objects.GXDLMSProfileGeneric

BR,
Mikko

Varun Sharma

5 years 6 months ago

In reply to Hi, by Kurumi

Hi sir,

Hi sir,
Tried many things but still cant get the value exactly.Can u please show an example.
I m doing obj->GetBuffer() but still no success.

Thank you

Profile picture for user Kurumi

Kurumi

5 years 6 months ago

Hi,

Hi,

Try to read Profile entries #8 and entries in use #7. When read capture objects and the buffer.
Profile entries

CGXDLMSProfileGeneric obj("1.0.94.91.0.255");//Instant
ret = comm.Read(&obj, 7,value);
ret = comm.Read(&obj, 8,value);

You should see correct values now. Read capture objects and the buffer.

ret = comm.Read(&obj, 2,value);
ret = comm.Read(&obj, 3,value);

Varun Sharma

5 years 6 months ago

Thanks sir for your support.

Thanks sir for your support.
I want to ask that this c++ application build exe in visual studio can work in Common Meter Reading instrument (CMRI) devices or not .
Because in CMRI only C or C++ exe works.

Profile picture for user Kurumi

Kurumi

5 years 6 months ago

Hi,

Hi,

There are several different CMRI from different manufacturers. Some CMRI's are running in Linux. You need to compile an app for Linux and you should be able to run it in CMRI. You need to verify this from the manufacturer of CMRI.

BR,
Mikko

Varun Sharma

5 years 6 months ago

Don't know about Linux but

Don't know about Linux but when I develop c++ exe on windows XP it works fine in CMRI.
Therefore I think this gurux c++ exe developed in visual studio should also work in it.
What's your opinion??

Profile picture for user Kurumi

Kurumi

5 years 6 months ago

Hi,

Hi,

I can't say for sure because I don't know what CMRI you are using but if it's working in Windows it should work in CMRI. The only thing you need to change is how to send and receive the bytes.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin