How to compile a program with curl and json functions

383 views
Skip to first unread message

Ivica

unread,
Nov 15, 2025, 3:03:17 PM (9 days ago) Nov 15
to Harbour Users
Hi!
I'm using Harbor 3.2.0dev (r1702081836)
I need to upgrade the existing program with a function for sending an xml file to the server, so I need curl and json functions for that. However, when I add any of those functions, hbmk2 reports an error
C:/hb32/comp/mingw/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibcurl
The line: hbcurl.hbc was added to prg.hbp

Can anyone tell me what version of Harbor I should install to be able to use the curl and json functions and what to add to the project.hbp file.
Thanks!

cod...@outlook.com

unread,
Nov 16, 2025, 6:03:55 AM (8 days ago) Nov 16
to Harbour Users

Hi Ivica.

I use Harbour to create and read XML, read JSON files, send XML to server using Curl, and read data from server.

May be this can help you. Here are people with more knowledge on this subject, but this is just for start. Sorry if I write something you already know, but this is how I see what to do.

First you must decide which compiler you will use (MSVC, MinGW, …). I use MinGW 32-bit version as my primary compiler. For some other purpouses I use MSVC 64 bit version.

If you use Windows OS, better is to use 64-bit OS version. I do not use Linux.

Then you must decide how to use (build) Harbour on your computer.

You can:

1.Use precompiled binary version of Harbour 3.2 (I do not use it)

2.Buid Harbour 3.2 from source (I use this option)

3.Use Harbour 3.4 version (I do not use it), fork made by Viktor Szakats. I think it also have binary version, or you can build it from source. Go to https://github.com/vszakats/hb .

If you want to use binary versions of Harbour, then you must find one which is already built with Curl and SSL.

If you want to build Harbour from source, then you must set some environment variables which will guarantee you building it with Curl and SSL.

When building Harbour from source you must decide will you make Curl static linking or not. Static linking is harder to accomplish (I did not used Curl static linking).

Also, you must download and install proper Curl and OpenSSL versions.

As an example, when building Harbour 3.2 from source on Windows PC, you can use next environment variables:

set HB_PATH=c:\harbour

set HB_ARCHITECTURE=win

set HB_COMPILER=mingw

set HB_INSTALL_PREFIX=c:\harbour

set HB_STATIC_OPENSSL=yes

set HB_WITH_OPENSSL=c:\openssl\include

set HB_WITH_CURL=c:\curl\include

 

You must copy all *.a files from c:\curl\lib folder (if you installed Curl in c:\curl folder) to c:\harbour\lib\win\mingw folder.

You must put libcurl.dll form C:\curl\bin in folder where exists your application .EXE file (if Curl not static linked).

To create XML  I use MiniXML, see c:\harbour\contrib\hbmxml.

To read XML  I use TXML, , see c:\harbour\contrib\xhb.

To work with JSON, see https://www.kresin.ru/en/hrbfaq_3.html#Doc13 , read topics about hash arrays and JSON. Also read messages on this group.

In harbour-users group you can find many messages on this subjects.

Regards,

Simo.

lucima...@gmail.com

unread,
Nov 17, 2025, 9:02:28 AM (7 days ago) Nov 17
to Harbour Users
Hi, 
everything alright? I liked your explanation about curls, which I also can't compile. Since I also use Harbour version 3.2 with MinGW, I wanted to know if you could make the curl package you have available so I can test it in my environment to see if it works. Thank you in advance.

cod...@outlook.com

unread,
Nov 17, 2025, 10:24:01 AM (7 days ago) Nov 17
to Harbour Users
Hi Ivica.

I would like to help you but it requires private email messages to define how could I send what you need, etc.
If you have some temporary email address, please write it here, and then we will continue our conversation using that mail. Where is no need to do it in this place. 

Regards,
Simo.
 

Gerald Drouillard

unread,
Nov 17, 2025, 10:39:32 AM (7 days ago) Nov 17
to harbou...@googlegroups.com
Using msys for building harbour on windows has been great for keeping up with changes to curl and ssl.

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/e3bcd257-eb10-4f39-a432-b95678c5092cn%40googlegroups.com.

Ivica

unread,
Nov 17, 2025, 11:02:25 AM (7 days ago) Nov 17
to Harbour Users
Hello everyone!

It seems I'm not the only one having problems finding and linking libraries.

Unfortunately, I'm currently in a bit of a rush because I'm working on a program for sending/receiving e-Invoices that will be mandatory in Croatia from January 1, 2026 and I'm not doing it in Harbour. In fact, I only have one remaining user on the old Harbour program and I think I'll do it for him in Python and just pick up the communication with the server in Harbour (I'm sure it will save me a lot of coding hours).

Overall, Harbour is a really useful and powerful programming tool with great upgradeability, but it would be more than desirable if users didn't have to figure out which libraries to add and where to find them in order to implement a new (existing) function.

I'm still on hbmk2 / mingw and that's probably the reason for a good part of the problem, but upgrading to something higher - will have to wait for now!

Thanks everyone for your time and help!

Lucimauro Melo

unread,
Nov 18, 2025, 7:32:24 AM (6 days ago) Nov 18
to harbou...@googlegroups.com
Hi, so would you be able to send the curl package you use to this
email address so I can test it in my environment? I would be very
grateful.

Em seg., 17 de nov. de 2025 às 12:24, cod...@outlook.com
<cod...@outlook.com> escreveu:
> --
> You received this message because you are subscribed to the Google Groups "Harbour Users" group.
> Unsubscribe: harbour-user...@googlegroups.com
> Web: https://groups.google.com/group/harbour-users
> ---
> You received this message because you are subscribed to a topic in the Google Groups "Harbour Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/harbour-users/jMzBj1Twtww/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to harbour-user...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/harbour-users/a2316028-3576-484d-b876-8763bb3c8319n%40googlegroups.com.

Francesco Perillo

unread,
Nov 18, 2025, 8:34:57 AM (6 days ago) Nov 18
to harbou...@googlegroups.com

I decided not to use libcurl but instead call an external curl executable. In this way I was able to update the executable indipendently from my program where the provider upped the TLS requirements.

I usually write a file.json and the run upload.cmd taht POSTs the json and saves the answer in a json file. I read that file and check the answer...

Klas Engwall

unread,
Nov 18, 2025, 4:30:35 PM (6 days ago) Nov 18
to harbou...@googlegroups.com
I did the same a couple of years ago, after reading a message from
Victor (who now runs the Curl support) where he said that that is
probably the only way because of all the dependencies that change
versions all the time. The precompiled executable is the same until you
decide to upgrade it, so no versionitis.

Regards,
Klas

Gerald Drouillard

unread,
Nov 18, 2025, 5:48:33 PM (6 days ago) Nov 18
to harbou...@googlegroups.com
You can always use msys or Linux.

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/f22909ec-e9bb-b751-8bbc-6d0476b92970%40engwall.com.

cod...@outlook.com

unread,
Nov 19, 2025, 1:48:34 AM (5 days ago) Nov 19
to Harbour Users

< I decided not to use libcurl but instead call an external curl executable. In this way I was able to update the executable independently from my program where the provider upped the TLS requirements.>

 

I use both variants.  In one application I use only libcurl, working with REST API and all goes very good. 

On some other server I could not make one REST API to work with libcurl, so I also used external Curl executable. Example I found in

https://groups.google.com/g/harbour-users/c/KG8nHIJfTRM/m/dQkUtl9PBAAJ  .

So only one REST API I send with external Curl executable, but all other works with libcurl.

I send and read XML and JSON files.

Regards,
Simo.

Eric Lendvai

unread,
Nov 20, 2025, 1:40:36 PM (4 days ago) Nov 20
to Harbour Users
Here is a fully functioning example and setup that uses curl under Windows and Linux (WSL/Docker) via VSCode.


Using the official latest Harbour.

Hope this helps, Eric
Reply all
Reply to author
Forward
0 new messages