Migration from Bcc to msvc

Migration from Bcc to msvc

Postby reinaldocrespo » Fri Mar 06, 2015 1:29 am

I currently use bcc. I make my projects with xmate. It works well. Wish to start using msvc. I have no idea how to begin using msvc++ compiler. Here are some questions:

1. Is there a guide?
2. can I /should I continue to use xmate to make my projects?
3. Do you setup msvc studio to use the full IDE or do you continue to use your old editor?

Thank you,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Migration from Bcc to msvc

Postby Antonio Linares » Fri Mar 06, 2015 5:59 am

Reinaldo,

1. viewtopic.php?f=17&t=28723

2. If you use MSVC there is no need to use xMate. However for a certain time you could use it to have your project built in both ways.

3. You can use the full MSVC IDE: Anyhow we need a Harbour language extension for MSVC, and thats why we hired Sarabjeet to work on it.
Sarabjeet is delayed, don't know exactly why. Hopefully he completes his work as he promised to do :-)

Just sent this to Sarabjeet:
Dear Sarabjeet,

Please review this:

viewtopic.php?p=173503#p173503

I would love to get something from you, at least something that we can use to continue your work. Please.

best regards,

--
Antonio Linares
www.fivetechsoft.com
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Migration from Bcc to msvc

Postby Rick Lipkin » Fri Mar 06, 2015 2:10 pm

Reinaldo

I would also be curious about MVSC specifically for 64 bit since Microsoft seems to be the only 64 bit compiler. In an earlier question I asked Antonio if we could just break out the Cl.exe compiler from Visual Studio and the answer was No, because it is too integrated into the IDE.

I use xMate as well and I have an old environment when you could use the command MVSC compiler.. don't know if that would help you much since it was back from 2006 and the MVSC ToolKit ?

Anyway .. it might give you and Antonio some inspiration.

Rick Lipkin
Code: Select all  Expand view  RUN

[Environment]
Description 1=finally got a good
Description 2=working MSVC environment !!  Includes the new
Description 3=xHarbour libs hbsix and pcrepos
PRG Compiler ver=xHarbour 99.51
C compiler ver=MSVC 2003 Toolkit
Subsystem=FWH28
Author=Richard Lipkin
Last update=11/06/2006

[Advanced]
Command types=1,1,1,1,1,1,1,1,1

[Harbour]
HB_INSTALL=C:\XHARBOUR
HB_COMMAND=%HB_BIN_INSTALL%\Harbour.Exe %PRG% /m /n /gc0 /w0 /es2 /a /i%HB_INC_INSTALL% /d__EXPORT__
Option prefix=/

[C]
C_INSTALL=C:\MSVC
C_COMP_COMMAND="%C_BIN_INSTALL%\cl.exe" -c -TP -W3 -nologo  -I"%C_INC_INSTALL%" /I%HB_INC_INSTALL%   -Fo%OBJ% %C%
C_LIB_COMMAND=%C_BIN_INSTALL%\LIB.Exe /OUT:%LIB%  @%RSP% /LIST >%LST%
C_LINK_COMMAND=%C_BIN_INSTALL%\LINK.Exe /subsystem:WINDOWS /FORCE:MULTIPLE%CRLF% /LIBPATH:%C_LIB_INSTALL% @%LNK%
C_RC_COMMAND=%C_BIN_INSTALL%\RC.Exe -r  -fo%RES%  %RC%
C_DLL_COMMAND=
Option prefix=-

[User]
POSTEXE_COMMAND=
POSTLIB_COMMAND=
POSTDLL_COMMAND=

[Files]
%HB_LIB_INSTALL%\dbfcdx.lib=1
%HB_LIB_INSTALL%\dbffpt.lib=2
%HB_LIB_INSTALL%\lang.lib=3
%HB_LIB_INSTALL%\vm.lib=4
%HB_LIB_INSTALL%\rtl.lib=5
%HB_LIB_INSTALL%\rdd.lib=6
%HB_LIB_INSTALL%\macro.lib=7
%HB_LIB_INSTALL%\pp.lib=8
%HB_LIB_INSTALL%\dbfntx.lib=9
%HB_LIB_INSTALL%\common.lib=10
%HB_LIB_INSTALL%\gtwin.lib=11
%HB_LIB_INSTALL%\codepage.lib=12
%HB_LIB_INSTALL%\pcrepos.lib=13
%HB_LIB_INSTALL%\hbsix.lib=14
C:\FWH28\LIB\Fivehmx.lib=15
C:\FWH28\LIB\Fivehcm.lib=16
%C_LIB_INSTALL%\kernel32.lib=17
%C_LIB_INSTALL%\Mpr.Lib=18
%C_LIB_INSTALL%\Ole32.Lib=19
%C_LIB_INSTALL%\Shell32.Lib=20
%C_LIB_INSTALL%\User32.Lib=21
%C_LIB_INSTALL%\WinMM.Lib=22
%C_LIB_INSTALL%\WinSpool.Lib=23
%C_LIB_INSTALL%\AdvAPI32.Lib=24
%C_LIB_INSTALL%\ComCtl32.Lib=25
%C_LIB_INSTALL%\ComDlg32.Lib=26
%C_LIB_INSTALL%\Gdi32.Lib=27
 
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Migration from Bcc to msvc

Postby reinaldocrespo » Fri Mar 06, 2015 3:05 pm

Hey Rick!

Thank you. I'm not sure how much time I can dedicate to this, but I'll keep you posted of any progress.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Migration from Bcc to msvc

Postby reinaldocrespo » Fri Mar 06, 2015 8:48 pm

Antonio /anyone else working with msvc:

I like the IDE and the source editor. I got .prgs + .c files to compile for one of my projects (the simplest one but still it contains over 70 .prg source files).

1. I now need to learn how to compile .rc files.

2. I need to implib a few .dlls into .lib. How do you do so with msvc?

3. I'd like to compile a few pure .c sources into a .lib. With bcc I would simply use the command line to compile .c files into .obj and then used the lib utility to create the .lib from these .objs. is there a way to do that with msvc?

4. I'm using msvc++ studio version 10, but I also have version 11, 12 and 13. Is there a particular version I should use?


Thank you,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Migration from Bcc to msvc

Postby Antonio Linares » Sat Mar 07, 2015 1:03 am

Reinaldo,

1. If you add an existing rc file into the "Resource Files" of your project, it gets automatically compiled into a RES file.

Right click on it and select "compile" to check this.

2. For the PRGs in the project we create a "custom build tool"

Image

Image

You could do the same for each LIB file, and then invoke MSVC lib.exe to generate the DEF file from the DLL, and then call lib.exe again to generate the LIB using the DEF.

3. Simply place your C files in the "Source Files" section of your project. If you place them there, then you don't need to create a LIB for them.

4. Always try to use the highest one, which it is the most recent MSVC version.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Migration from Bcc to msvc

Postby reinaldocrespo » Sat Mar 07, 2015 2:30 am

Antonio and anyone who may have an answer;


Answers #1, #3, and #4; I understand. Thank you very much.

Answer #2... I'm still not getting it. So, suppose I want to create a msvc compatible .lib from ace32.dll, should I add ace32.dll to the project under libs an build it with a custom build using msvc lib.exe? Can you show how or point to another thread where this is being done? I think the reason this is confusing is because the sample you provide here is building .prgs into .c not .dll into .libs. I don't think we want to custom build a .lib from .dll using c:\harbour\bin\harbour... not will the output be .\%(filename).c

I'm sorry I didn't get #2.

Thank you,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Migration from Bcc to msvc

Postby Antonio Linares » Sat Mar 07, 2015 8:07 am

Reinaldo,

First of all, we need to create the DEF file. Using Microsoft lib.exe you could do:

lib.exe /DEF:ace32.def ace32.dll

If the above fails, then use Borland impdef.exe as the DEFs are compatible and they are just ascii files:

impdef.exe ace32.def ace32.dll

Once you have the DEF file then use Microsoft lib.exe again:

lib.exe /DEF:ace32.DEF /OUT:ace32.lib
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Migration from Bcc to msvc

Postby reinaldocrespo » Sun Mar 08, 2015 9:20 pm

Antonio;

Perfect. All is good. Thank you very much.

I like VS IDE, even the source code editor. I hope Sarabjeet finds inspiration to continue his work. I'm still missing some features from Ultraedit but maybe it is only because I don't know enough. For example: with Ultraedit, the editor "guesses" what you are typing by looking at previous words written on that same file. I'm not talking about language reserved words alone, I mean, comments, variables etc... I find that very helpful and time-saving as you don't have to type every single letter before it knows what you are about to type and it finishes it for you. Most times I only have to type 1, 2 or 3 letters before hitting <enter> as the editor finishes the rest of the word/variable/command/statement for me.

Does anybody know if this is possible with VS source code editor?


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Migration from Bcc to msvc

Postby Antonio Linares » Sun Mar 08, 2015 10:31 pm

Reinaldo,

Sarabjeet has told me to have a TeamViewer session to show me how to use what he already has done. Waiting for this :-)

I know that feature very well as I also appreciate it very much. In fact in FWH\samples\Fivedit.prg we have included it:

https://bitbucket.org/fivetech/fivewin-contributions/downloads/fivedit.zip

Visual Studio IDE has several options to setup the "Intellisense" but I have not been able to found that functionality in the several options it offers.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Migration from Bcc to msvc

Postby reinaldocrespo » Tue Mar 10, 2015 2:52 am

As I continue trying to port 1 app over to msvc, I'm now getting some link errors. I tried looking for these on the forum but could not find much. Help?

Code: Select all  Expand view  RUN

1>  Generating Code...
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/FORCE' specification
1>FiveHMX.lib(ERRSYSW.obj) : warning LNK4006: _HB_FUN_ERRORSYS already defined in ErrorSysW.obj; second definition ignored
1>ct.lib(ctmisc.obj) : warning LNK4006: _HB_FUN_CENTER already defined in funciones.obj; second definition ignored
1>rtl.lib(dllcall.obj) : warning LNK4006: _HB_FUN_LOADLIBRARY already defined in FiveHCM.lib(DLL.obj); second definition ignored
1>rtl.lib(dllcall.obj) : warning LNK4006: _HB_FUN_FREELIBRARY already defined in FiveHCM.lib(DLL.obj); second definition ignored
1>vm.lib(hvmall.obj) : warning LNK4006: _hb_vmPushSize already defined in FiveHMX.lib(HARBOUR.obj); second definition ignored
1>LINK : fatal error LNK1104: cannot open file 'LIBC.lib'
1>
1>Build FAILED.
 


I suppose the warning can be ignored. My problem is with "fatal error LNK1104: cannot open file 'libc.lib'". I don't think I have it declared anywhere, so why is it trying to open a lib that I have not included? Should I include this lib?

Thank you,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Migration from Bcc to msvc

Postby Antonio Linares » Tue Mar 10, 2015 7:15 am

Reinaldo,

Use this linker flag:

/NODEFAULTLIB:libc
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Migration from Bcc to msvc

Postby reinaldocrespo » Tue Mar 10, 2015 1:05 pm

Antonio;

Thank you. I now understand what the /NODEFAULTLIB linker directive means.

I find that most of the functions being called that belong to a .lib that I have included on the project are not being found by the linker. See below a small sample of all the missing functions that I know are on the .libs declared on the libraries folder of the project:


Code: Select all  Expand view  RUN

TSCAN.obj : error LNK2019: unresolved external symbol _TWAIN_SetImageLayout@32 referenced in function _HB_FUN_TW_SETIMAGELAYOUT
1>TSCAN.obj : error LNK2019: unresolved external symbol _TWAIN_ResetImageLayout@0 referenced in function _HB_FUN_TW_RESETIMAGELAYOUT
1>TSCAN.obj : error LNK2019: unresolved external symbol _TWAIN_GetImageLayout@16 referenced in function _HB_FUN_TW_GETIMAGELAYOUT
1>TSCAN.obj : error LNK2019: unresolved external symbol _TWAIN_GetDefaultImageLayout@16 referenced in function _HB_FUN_TW_GETDEFAULTIMAGELAYOUT
1>TSCAN.obj : error LNK2019: unresolved external symbol _DIB_GetFromClipboard@0 referenced in function _HB_FUN_TW_DIB_GETFROMCLIPBOARD
1>FiveHCM.lib(KEYBRD.obj) : error LNK2019: unresolved external symbol _SendInput referenced in function _HB_FUN_SENDKEY
1>FiveHCM.lib(MEM.obj) : error LNK2019: unresolved external symbol _GlobalMemoryStatusEx referenced in function _HB_FUN_NEXTMEM
1>FiveHCM.lib(ARG.obj) : error LNK2019: unresolved external symbol ___argc referenced in function _HB_FUN_NARGC
1>FiveHCM.lib(ARG.obj) : error LNK2019: unresolved external symbol ___argv referenced in function _HB_FUN_CARGV
1>ct.lib(ctmath2.obj) : error LNK2019: unresolved external symbol __HUGE referenced in function _HB_FUN_LOG10
1>rtl.lib(math.obj) : error LNK2001: unresolved external symbol __HUGE
1>FiveHCM.lib(FWPNG.obj) : error LNK2019: unresolved external symbol _png_sig_cmp referenced in function _IsPng
1>FiveHCM.lib(FWPNG.obj) : error LNK2019: unresolved external symbol _png_destroy_write_struct referenced in function _save_png_to_file
1>FiveHCM.lib(FWPNG.obj) : error LNK2019: unresolved external symbol _png_free referenced in function _save_png_to_file
1>FiveHCM.lib(FWPNG.obj) : error LNK2019: unresolved external symbol _png_write_png referenced in function _save_png_to_file
 


Any ideas?

Thank you,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Migration from Bcc to msvc

Postby Antonio Linares » Wed Mar 11, 2015 5:54 am

Reinaldo,

TSCAN.obj : error LNK2019: unresolved external symbol _TWAIN_SetImageLayout@32 referenced in function _HB_FUN_TW_SETIMAGELAYOUT
1>TSCAN.obj : error LNK2019: unresolved external symbol _TWAIN_ResetImageLayout@0 referenced in function _HB_FUN_TW_RESETIMAGELAYOUT
1>TSCAN.obj : error LNK2019: unresolved external symbol _TWAIN_GetImageLayout@16 referenced in function _HB_FUN_TW_GETIMAGELAYOUT
1>TSCAN.obj : error LNK2019: unresolved external symbol _TWAIN_GetDefaultImageLayout@16 referenced in function _HB_FUN_TW_GETDEFAULTIMAGELAYOUT


You may need to create a new import library from the Twain DLL. Do you use a Twain DLL ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Migration from Bcc to msvc

Postby Antonio Linares » Wed Mar 11, 2015 5:55 am

1>FiveHCM.lib(FWPNG.obj) : error LNK2019: unresolved external symbol _png_sig_cmp referenced in function _IsPng
1>FiveHCM.lib(FWPNG.obj) : error LNK2019: unresolved external symbol _png_destroy_write_struct referenced in function _save_png_to_file
1>FiveHCM.lib(FWPNG.obj) : error LNK2019: unresolved external symbol _png_free referenced in function _save_png_to_file
1>FiveHCM.lib(FWPNG.obj) : error LNK2019: unresolved external symbol _png_write_png referenced in function _save_png_to_file


Are you linking Harbour png.lib ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests