Page 1 of 1

Detailed guide to use the Visual Studio 2013 IDE with FWH

Posted: Mon Jun 23, 2014 5:21 am
by Antonio Linares
1. Create a new project from Visual Studio:

Image

2. Select empty:

Image

3. Click on "Finish button"

4. You will get a project like this one:

Image

5. Right click on "Source files" and select "Add an existing item" and start adding your PRG files:

Image

6. Your PRGs will be shown in the "Solution Explorer":

Image

7. Right click on the PRG file and select these options and click on "OK":

Image

8. Right click again on the PRG file and these time fill these options this way and click "OK":

Copy the bold text from here:

c:\harbour\bin\harbour %(FullPath) /n /ic:\harbour\include /ic:\fwh\include

.\%(Filename).c

Warning: For Visual Studio Community 2015 use:

c:\harbour\bin\harbour "%(FullPath)" /n /ic:\harbour\include /ic:\fwh\include

If you are using an existing PRG located at a certain folder then use:

c:\harbour\bin\harbour "%(FullPath)" /o%(RelativeDir)%(Filename).c /n /ic:\harbour\include /ic:\fwh\include

%(RelativeDir)\%(Filename).c

Image

9. At this point you can right click on the PRG file on the "Solution Explorer" and select "compile".

Image

Alternatively you can already click at the top on Run ("Local Windows Debugger" the button with the "green play" bitmap) and it will get compiled.

10. Now you have to add the C file that Harbour generated to the project. Again Right click on "Source files" and select "Add an existing item" and
choose your filename.c, in this example tutor01.c

Image

The "Solution Explorer" will look like this:

Image

11. Right click on the C file and set this value and click on "OK":

Copy the bold text from here:

c:\harbour\include;%(AdditionalIncludeDirectories)

Image

12. Again right click on the C file, select compile and it should properly compile it:

Image

13. Now if you click at the top on Run ("Local Windows Debugger" the button with the "green play" bitmap), Visual Studio will try to build your app but the libraries have not been added yet, so you will get this:

Image

14. Now we are going to add the libraries, but to keep our project well structured, right click on the tutor01 in the "Solution Explorer", just below "Solution 'tutor01' (1 project) and add "New filter" (it creates a folder) and rename it as "Libraries". It will look like this:

Image

15. Right click on the Libraries folder and select "Add an existing item" and select FiveH32.lib, same for FiveHC32.lib:

Image

16. Now lets add the Harbour for Visual Studio 2013 libraries. You can add one by one, or simply select all of them, but VERY IMPORTANT some of them have to be removed: All that end with ..._dll.lib in their names.

You have to remove: hbnortl.lib, hbnulrdd.lib, harbour-32.lib, hbvmmt.lib, hbmaindllp.lib, hbmainstd.lib, hbmaindllp.lib. Right click on their names and delete them (you will go faster if you delete all ..._dll.lib files before adding all the libraries):

Image

Now if you try to build your app ("Local Windows Debugger" the button with the "green play" bitmap), you will find that some Windows libraries are still missing, so we are going to add them too: OleDlg.lib, msimg32.lib, version.lib, ComCtl32.lib

look for them at c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\

Image

Add them as you did before adding FWH libraries:

Image

To remove the linker warnings add this options:

/NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMT

Image

17. Now build your app and yes!!!, there it is!!! :-)

Image

Re: Detailed guide to use the Visual Studio 2013 IDE with FWH

Posted: Mon Jun 23, 2014 11:10 am
by Antonio Linares
To implement syntax highlighting in your PRG sources, please follow this topic:

http://forums.fivetechsupport.com/viewt ... =3&t=28600

Re: Detailed guide to use the Visual Studio 2013 IDE with FWH

Posted: Mon Jun 23, 2014 11:51 am
by Antonio Linares
Now, if you want to skip all the previous and tedious steps, simply download the project from here and open it from your Visual Studio:

https://bitbucket.org/fivetech/visual-s ... roject.zip

Re: Detailed guide to use the Visual Studio 2013 IDE with FWH

Posted: Sun Oct 12, 2014 12:39 am
by avista
Antonio

IS this work with xHarbour too ?

I have try wiht Harbour and xHarbour
In both cases error

C:\fwh\Harbour\lib\bz2.lib : fatal error LNK1136: invalid or corrupt file

That for all libs

Some solution ?

Best regards,

Re: Detailed guide to use the Visual Studio 2013 IDE with FWH

Posted: Sun Oct 12, 2014 8:54 am
by cnavarro
You've built Harbour or xHarbour to Visual Studio 2013?

Re: Detailed guide to use the Visual Studio 2013 IDE with FWH

Posted: Sun Oct 12, 2014 11:38 am
by Antonio Linares
Avista,

Is bz2.lib for Microsoft ?

You can not use Borland's libs with Visual Studio.

Re: Detailed guide to use the Visual Studio 2013 IDE with FWH

Posted: Sun Oct 12, 2014 10:24 pm
by avista
Antonio,

Sorry my bad.

I installed harbour for vs: harbour_3.2_32bits_MSVC2013_20142906 and maded everything like in your sample
I get this error:

1>------ Build started: Project: tutor01, Configuration: Debug Win32 ------
1>FiveH32.lib(ERRSYSW.obj) : error LNK2005: _HB_FUN_ERRORSYS already defined in hbrtl.lib(errsys.obj)
1>FiveH32.lib(ERRSYSW.obj) : error LNK2005: _HB_FUN_HB_GTSYS already defined in hbrtl.lib(gtsys.obj)
1> Creating library C:\myapp\tutor01\Debug\tutor01.lib and object C:\myapp\tutor01\Debug\tutor01.exp
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\myapp\tutor01\Debug\tutor01.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Regards,

Re: Detailed guide to use the Visual Studio 2013 IDE with FWH

Posted: Sun Oct 12, 2014 10:59 pm
by Antonio Linares
Please go to samples folder and try this:

buildh32 tutor02

if it works, then please review buildh32.bat

Re: Detailed guide to use the Visual Studio 2013 IDE with FWH

Posted: Fri Nov 14, 2014 9:46 am
by mbelgrano
Intresting project for use Visual Studio Ide but is/will possible Create a Language Compiler for habour in the .NET Framework?
http://msdn.microsoft.com/en-us/magazine/cc136756.aspx

Re: Detailed guide to use the Visual Studio 2013 IDE with FWH

Posted: Fri Nov 14, 2014 1:54 pm
by Antonio Linares