error with compiler

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
motobrazi
Posts: 1
Joined: Thu Oct 16, 2014 7:24 pm

error with compiler

Post by motobrazi »

hello
i am using windows 8.1 zeus 3.97u
i am setting up for cobol compiler like suggested in this forum and get the following error

Using document type compiler options....
cob31F.c
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'
i am also using visual studio 2013 pro.
please help has to work so i can get approval to buy for company.
Gator
MotoBrazi
Brazil
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Gator,
i am setting up for cobol compiler

Which COBOL compiler are you using :?:
Using document type compiler options....
cob31F.c
Is that a COBOL file :?:

If it is a COBOL file try naming it as cob31F.cob instead.

Because the name of the file is cob31F.c Zeus would have picked the C/C++ Document Type and tried to compiled the file as a C file.
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'
And this line shows that the Microsoft Compiler/Linker was used to build that file.

So the question is did you want to compile the file as a C file or a COBOL file :?:
i am also using visual studio 2013 pro.
To setup Zeus to work with Visual Studio just create a shortcut ze.cmd file that comes with Zeus.

Details on how to do this is found here: http://www.zeusedit.com/zforum/viewtopic.php?t=2707
You will have to edit that ze.cmd file and add this to the top of the file:

Code: Select all

REM Microsoft Visual Studio 2013
:VS2013
if not exist "C:\Program Files\Microsoft Visual Studio 13.0\Common7\Tools\vsvars32.bat" goto VS2013a
call "C:\Program Files\Microsoft Visual Studio 13.0\Common7\Tools\vsvars32.bat"
goto Zeus

REM Microsoft Visual Studio 2013 - 64 Bit
:VS2013a
if not exist "C:\Program Files (x86)\Microsoft Visual Studio 13.0\Common7\Tools\vsvars32.bat" goto VS2011
call "C:\Program Files (x86)\Microsoft Visual Studio 13.0\Common7\Tools\vsvars32.bat"
goto Zeus
Let me know how you get on ;)

Cheers Jussi
krigul
Posts: 9
Joined: Mon Jan 05, 2015 3:32 pm

Re: error with compiler

Post by krigul »

I am new to ZEUS, I installed it and I am trying to compile a simple gnu Cobol program and getting the error

CL.exe doesn't exist.

I've checked to see where it is to add a path but couldn't find it. I use visual studion 11.0 on windows 7.

Any help is greatly apreciated as this will be used for a migration project.

Thanks,
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: error with compiler

Post by jussij »

Here is a step by step example of setting up Zeus for GNU Cobol.

http://zeusedit.com/phpBB3/viewtopic.php?f=5&t=7174

MORE INFORMATION
As you can see from my earlier post I was a bit confused by the earlier questions as it asked for information about cl.exe in a question about COBOL.

As this is the second time that same question has been asked, this time I did a Google search and the link below shows that there is indeed a link between cl.exe and Open Cobol:

http://sourceforge.net/p/open-cobol/mai ... /24534877/

So the issue you will face is making sure you have Microsoft C/C++ installed as well as GNU Cobol.

In my case I did not run into that issue since Zeus is written in Microsoft C/C++ so for me it was already installed.

So to make this work inside of Zeus would will need to do the following:

1) Install some form of Microsoft C/C++ (i.e. Express, Community, Professional etc)

2) Make sure the Microsoft C/C++ vsvars32.bat file is found and run.

More details on this can be found here: http://www.zeusedit.com/zforum/viewtopic.php?t=2707

3) Try the GNU COBOL link mentioned earlier.

But since you are getting a cl.exe error I suspect all you need to worry about are steps one and two.

Cheers Jussi
krigul
Posts: 9
Joined: Mon Jan 05, 2015 3:32 pm

Re: error with compiler

Post by krigul »

Thanks for your help, I added C++ express edition, I run vsvars32.bat then compiled and got the same error. I checked where cl.exe is and I added it to the PATH manually then I run the compile and it just hunged with the following message

<<
Using document type compiler options....
>>

What I am doing wrong, I use windows 7 and I used the sample HELLO program provided with gnu cobol.

Thanks,
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: error with compiler

Post by jussij »

What I am doing wrong
If you are still getting this message then it means the setup is still not correct.

Code: Select all

'cl1.exe' is not recognized as an internal or external command, operable program or batch file.
So the first step is to get the C++ Express correctly installed.

Could you try this.

Step 1: Create Desktop Shortcut to the ze.cmd Batch File
Use the mouse right click button on the desktop an then use the New, Shortcut menu to create a shortcut with the following details:

Code: Select all

Target: "C:\Program Files (x86)\Zeus\ze.cmd"
Run: Minimized
Icon: Hit the Change Icon button, browse to "C:\Program Files (x86)\Zeus\zeus.exe" and select the Zeus icon.
Step 2: Click on that Icon
That will start Zeus after running the vsvars32.bat file, which means Zeus will now have an environment suitable for C++ Express.

Step 3: Check that C++ Express Works
To test that C++ Express is working use the Zeus Tools, DOS Command Line menu and run this command:

Code: Select all

cl.exe -?
That command should run the cl.exe compiler and output the options.

If Step 3 worked then try to compile you COBOL file.

Cheers Jussi
krigul
Posts: 9
Joined: Mon Jan 05, 2015 3:32 pm

Re: error with compiler

Post by krigul »

Slowly i am getting somewhere, ze.cmd worked and i am compiling the sample hello program and i am getting the following messages uisng gnu cobol. This should compile with no error, is there any other configuration that i should know about?

test.obj : error LNK2019: unresolved external symbol __imp__cob_stop_run referenced in function _main

test.exe : fatal error LNK1120: 8 unresolved externals
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: error with compiler

Post by jussij »

I did a Google search for __imp__cob_stop_run and found this link:

http://www.opencobol.org/modules/newbb/ ... =5940#5940

That link suggests the problem is mixing a 32 bit C/C++ compiler with a 64 bit COBOL compiler.

As per that link it suggests checking the compiler being used with the -v option.

You can add that option in Zeus using the Options, Document Types menu and in the COBOL document type select the Compiler panel and change the compiler command to be this:

Code: Select all

cobc.exe -v -x "$fn"
If you something like this in the output it means might have the same issue:

Code: Select all

Microsoft (R) 32-bit C/C++ Optimizing Compiler .....

Cheers Jussi
krigul
Posts: 9
Joined: Mon Jan 05, 2015 3:32 pm

Re: error with compiler

Post by krigul »

I re-installed gnu cobol 32 bits and that is working with the sample program. Now it's time to test more serious programs.
Thanks for all your help Jussi
krigul
Posts: 9
Joined: Mon Jan 05, 2015 3:32 pm

Re: error with compiler

Post by krigul »

I have a question regarding the debugging for GNU cobol. I am compiling my program with the debugger and creating a workspace for it, but how can I set my breakpoints, when I do list source code I don't see the source.

Should the worspace have the same name as program name?
Thanks,
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: error with compiler

Post by jussij »

One of the issues you will face is the gdb debugger only works with the GCC compiler.

In you case you are using the Microsoft Express C/C++ compiler, so that is not going to work :(

When I wrote those COBOL tutorials (quite some time ago) I suspect at that time OpenCOBOL defaulted to using GCC as the compiler, so I don't have any experience with this newer version COBOL compiler.

So I would say you have two choices:

1) Try to debug the intermediate C code inside of the Visual Studio IDE.

2) Use a GCC based compiler instead of the Microsoft Express C/C++ compiler.

Looking at the COBOL FAQ there is this switch to set the C compiler:

Code: Select all

--with-cc=<cc>

If you try the GCC approach I would recommend the TDM-GCC compiler.

Details on how to use that compiler can be found here: viewtopic.php?f=5&t=7423

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: error with compiler

Post by jussij »

I have had another play with the GNU Cobol and undated the instructions: viewtopic.php?f=5&t=7174

When I try to run the resulting executable using the gdb debugger I get this output:

Code: Select all

Module:'CobolTest.exe'
Directory:'C:\temp\CobolTest\'
Command Line:'gdb.exe -nw --fullname CobolTest.exe'

GNU gdb (GDB) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from CobolTest.exe...(no debugging symbols found)...done.
(gdb)
As suspect the gdb debugger does not understand the debug information created by the Microsoft compiler:

Code: Select all

Reading symbols from CobolTest.exe...(no debugging symbols found)...done.
Also the --with-cc=<cc> option is no help as that is not a Cobol compiler option but an option on how to build the compiler from source :(

Cheers Jussi
krigul
Posts: 9
Joined: Mon Jan 05, 2015 3:32 pm

Re: error with compiler

Post by krigul »

That is fine, I am putting a lot of displays in my program as an alternative.
Thanks,
Post Reply