Page 1 of 2

MS Visual Studio

PostPosted: Wed Jul 06, 2022 5:47 pm
by Detlef
Dear all,
I still use my SemWare editor to write my source code and rum buildx.bat to create my exe files.
Now I'd like to gain more comfort to my workflow.

I looked around to find a possibility to use the IDE Netbeans which I used for years for php development.
This was an excellent IDE to work with. Unfortunatelly there is no way to use it with FiveWin and xHarbour.

Here, in the forum I read about MS Visual Studio.
I have some question about the use of VS.
* can I use xHarbour with VS or will I have to use Harbour?
* do exe files built with VS need the complete MS Visual C++ Redistributable system files on the user's PC?

Thanks for each hint
Detlef

Re: MS Visual Studio

PostPosted: Wed Jul 06, 2022 6:01 pm
by TimStone
I have used Visual Studio for years. However, I use Ultra Edit Studio for all my coding. I do use Harbour and FiveWin, both 32 bit and 64 bit versions.

Here is how I do it:

I code my programs in UE Studio. This allows me a lot of flexability since I may have files opened from several projects.

When I make modifiations, I "build" the program in Visual Studio which is also open on my desktop. This is very quick, and of course immediately detects any errors or conflicts.

Once it is built, it automatically executes the program, and I can test the changes. I can then immediately fix them in the code and rebuild the application.

For actual releases, I have a .bat/.mak combo ( though Antonio recommends hbMake2 ) which compiles and links the final distribution product.

I have placed the Visual Studio builds on test sites, and I only install the .EXE and appropriate .DLL files.

You can probably work fine with xHarbour. Visual Studio paths should point to those directories for the compiler, linker, include files, and .lib files. You use the Custom Build Tool to compile .prg files so just configure that for your xHarbour .exe files.

I have done this for many years and never have a problem. You could do everything with the Visual Studio editor, though in the past I did set it up to call the Ultra Edit editor by default within Visual Studio. It is a customizable IDE.

I hope this helps.

Re: MS Visual Studio

PostPosted: Wed Jul 06, 2022 8:00 pm
by Detlef
Many thanks, Tim for your valuable information.
Could you please, tell me if on the target computer which will run my VS built exe, if there the MS Visual C++ Redistributable must be installed?

Regards, Detlef

Re: MS Visual Studio

PostPosted: Wed Jul 06, 2022 8:22 pm
by TimStone
I do not install the redistributable, and my clients have never had a problem. I believe that is only needed for .NET applications, but I'm not sure.

I include .dll's for some 3rd party products I use, and that is all.

Re: MS Visual Studio

PostPosted: Thu Jul 07, 2022 5:03 am
by Antonio Linares
Dear Detlef,

Do yourself a favour: start using Harbour and install Microsoft Visual Studio Community 2022

You will feel like driving a brand new car... :-)

Re: MS Visual Studio

PostPosted: Thu Jul 07, 2022 2:41 pm
by Detlef
Thanks for encouraging me, Antonio.
A new car is always something fine. :D

I tried to find out if it's possible for my programming to change from xHarbour to Harbour.
But the first test gave me the following linking errors:
Code: Select all  Expand view

│ FiveWin for Harbour 22.03 - Mar. 2022           Harbour development power  │▄
(c) FiveTech 1993-2022 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 │█
└────────────────────────────────────────────────────────────────────────────┘█
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Compiling...
Harbour 3.0.0 (Rev. 16951)
Copyright (c) 1999-2011, http://harbour-project.org/
Compiling 'browse.prg' and generating preprocessed output to 'browse.ppo'...
Lines 5024, Functions/Procedures 1
Generating C source output to 'browse.c'... Done.
Embarcadero C++ 7.00 for Win32 Copyright (c) 1993-2015 Embarcadero Technologies, Inc.
browse.c:
Borland Resource Compiler  Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation.  All rights reserved.
Turbo Incremental Link 6.70 Copyright (c) 1997-2014 Embarcadero Technologies, Inc.
Error: Unresolved external '_HB_FUN_OCCURS' referenced from D:\ENTW\FWH22\LIB\FIVEH.LIB|VALTOSTR
Error: Unresolved external '_hb_strAtI' referenced from D:\ENTW\FWH22\LIB\FIVEH.LIB|VSTRFUN1
Error: Unresolved external '_HB_FUN___OLEVARIANTNEW' referenced from D:\ENTW\FWH22\LIB\FIVEH.LIB|ADOFUNCS
Error: Unresolved external '_HB_FUN_HB_BLEN' referenced from D:\ENTW\FWH22\LIB\FIVEH.LIB|OLEFUNCS
Error: Unresolved external '_hb_extIsNil' referenced from D:\ENTW\FWH22\LIB\FIVEHC.LIB|RICHEDIT
Error: Unresolved external '_HB_FUN_HB_TSTOUTC' referenced from D:\ENTW\FWH22\LIB\FIVEH.LIB|VALTOSTR
Error: Unable to perform link
* Linking errors *
 

I wanted to build the program 'browse' from the FWH samples folder.
Before I put the correct Paths into buildh.bat.
Must I edit something of my environment or in buildh.bat?

Re: MS Visual Studio

PostPosted: Thu Jul 07, 2022 3:56 pm
by Antonio Linares
Dear Detlef,

It seems as you are using an old Harbour version. Yours is Harbour 3.0.0 (Rev. 16951) and current one is Harbour 3.2.0dev (r2004201301)

Please download it from here:
https://github.com/FiveTechSoft/Harbour_builder/blob/master/harbour_win32_bcc_2020_10_19.zip

We have recently published a new zip file that contains all Harbour versions (in case that you want to test with Microsoft Visual Studio Community, or if you want to compare the results building with Borland, Microsoft or MinGW gcc):
https://www.fivetechsoft.com/files/harbour/harbour_all.zip

Re: MS Visual Studio

PostPosted: Fri Jul 08, 2022 6:03 pm
by Detlef
Thanks Antonio,
now I got the actual version of Harbour and the sample compiled like a charm.

But as with all new cars they have more sensitive brakes ;-)
I tried to compile my softare and Harbour complains
rg.prg(239) Error E0030 Syntax error "syntax error at ')'"

Code: Select all  Expand view
  WITH OBJECT oBrwPos:aCols[ 2 ]
      :cSortOrder    := NIL
      :cOrder        := NIL
      :AddResource( "SEARCH_R" )
      :nHeadBmpNo    := 1
      :nHeadBmpAlign := AL_RIGHT
      :bRClickHeader := ;
      :bLClickHeader := { || if( oBrwPos:nArrayAt > 0,;
                                 ( nSel := nGetPosArt( oBrwPos:GetRect() ),;
                                   if( nSel > 0,;
                                       ( aPos[ oBrwPos:nArrayAt ][ 2 ] := aPosCfg[ nSel ][ _LEISTUNG ],;
                                         aPos[ oBrwPos:nArrayAt ][ 4 ] := aPosCfg[ nSel ][ _IS_KOST ],;
                                         aPos[ oBrwPos:nArrayAt ][ 5 ] := aMwStSaetze[ aPosCfg[ nSel ][ _MWSTSATZ ] ],;
                                         oBrwPos:Refresh(),;
                                         oBrwPos:SetFocus(),;
                                         oBrwPos:nColSel := 3, oBrwPos:aCols[ 3 ]:Edit();
                                       ), NIL ),;
                                        ), NIL ) } //<--- this is line 239
   END
 

With xHarbour this compiled okay.
I don't know what to correct in my code.

Re: MS Visual Studio

PostPosted: Fri Jul 08, 2022 7:00 pm
by carlos vargas
Code: Select all  Expand view

      :bLClickHeader := { || IIf( oBrwPos:nArrayAt > 0,;
                                 ( nSel := nGetPosArt( oBrwPos:GetRect() ),;
                                   IIf( nSel > 0,;
                                   ( aPos[ oBrwPos:nArrayAt ][ 2 ] :=              aPosCfg[ nSel ][ _LEISTUNG ],;
                                     aPos[ oBrwPos:nArrayAt ][ 4 ] :=              aPosCfg[ nSel ][ _IS_KOST  ],;
                                     aPos[ oBrwPos:nArrayAt ][ 5 ] := aMwStSaetze[ aPosCfg[ nSel ][ _MWSTSATZ ] ],;
                                     oBrwPos:Refresh(),;
                                     oBrwPos:SetFocus(),;
                                     oBrwPos:nColSel := 3,;
                                     oBrwPos:aCols[ 3 ]:Edit();
                                   ), NIL ) ) , NIL ) } //<--- this is line 239
 

Re: MS Visual Studio

PostPosted: Fri Jul 08, 2022 7:42 pm
by Detlef
Many thanks, Carlos.
It was that comma too much :oops:

Now my application is built without errors.
But I have a new issue.
My app created with xHarbour and bcc7 started within 1 second.
Now with pure Harbour and bcc7 up takes at least 7 up to 10 seconds before the start dialog is shown.

Is this normal for Harbour built apps?

Re: MS Visual Studio

PostPosted: Fri Jul 08, 2022 10:39 pm
by carlos vargas
It is not normal, I also come from xharbour and I have not noticed any affectation at the speed level, for better or worse, and there have been various apps, the only thing to point out is that I only use tmysql for my data, I have not used dbf for years

Re: MS Visual Studio

PostPosted: Sat Jul 09, 2022 6:30 am
by Detlef
Hi Carlos,
I must explain better…
the speed of the running app is okay.
I think it’s the same as with xHarbour.
Only the time it takes to start ist extremely different.

Re: MS Visual Studio

PostPosted: Sat Jul 09, 2022 11:43 am
by Antonio Linares
Dear Detlef,

what does your app startup does that takes such time ?

Could you describe its steps ?

Re: MS Visual Studio

PostPosted: Sat Jul 09, 2022 12:44 pm
by Detlef
Dear Antonio,
my app just opens seven dbf files via dbfcdx in exclusive mode.
Then it checks if all Index files are present and created them if not.
After that I call my dialog for start which shows a button bar with 3 buttons and 3 XBrowses in one to many relationship.

My app runs on a local Windows 10 PC. Because my app is at the beginning those dbf files have a maximum of only 10 records.
As I described it takes about 1 second to start when built with xHarbour and about 6 or 7 seconds built with pure Harbour after I typed the exe name at my DOS prompt.
I guess what could be the reason.

Re: MS Visual Studio

PostPosted: Sat Jul 09, 2022 1:28 pm
by Antonio Linares
Dear Detlef,

you could save on a log file several calls to GetTickCount() to see what part consumes more time

My guess is that Harbour does more things than xHarbour, but due to its more robust and safe design

But I may be wrong. Lets wait for your results... :-)