Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

error - compiled exe is 16bit

olslewfoot
Beginner
7,846 Views

I have a 64 bit Windows7 Enterprise PC with icore7 and 2.4Ghz.

I have Intel Parallel Studio XE2013 alongside MS Visual Studio 2010 which I'm a new-be with!

When I compile my fortran code the compilation completes but when the application launches I get a Windows OS message saying that the application is 16bit and will not run on the 64 bit PC.

I'm using the ia32 compiler which I understood would be ok on the 64 bit PC.

Can you suggest what I've got wrong or what I can do to rectify this please?

Thanks

John

0 Kudos
43 Replies
SergeyKostrov
Valued Contributor II
5,044 Views
>>...When I compile my fortran code the compilation completes but when the application launches I get a Windows OS message >>saying that the application is 16bit and will not run on the 64 bit PC... That is a less know problem to everybody because just a few developers in the world are doing any 16-bit programming. I had the same problem when I tried to execute some 16-bit applications ( a Turbo C++ compiler v3.0, for example ) under Windows 7 Professional 64-bit. However, my questions are: What is it? Where does it come from? How did you compile that 16-bit application? Is there a bat-file that is used somehow?
0 Kudos
TimP
Honored Contributor III
5,044 Views

It seems unlikely that supported versions of Visual Studio or Intel compilers could produce a 16-bit application, even when building for 32-bit target.  You must have a component which was copied over from some earlier system, as Windows X64 never supported any 16-bit binaries.

If your system supports installation of XPM (XP-32 running under virtualization), you could try running inside that.  CVF, for example, can install, build and run applications inside XPM.

0 Kudos
olslewfoot
Beginner
5,044 Views

The programme I'm compiling is in Fortran 95 and is a numerical hydrodynamic model. Its part of a suite of models the workflow for which is controlled by a python script - (the model suite is platform independent on windows or linux using this method).

The compiler call is to ifort.exe and the path to the compiler (in my case C:\Program Files (x86)\Intel\Composer XE 2013\bin\ia32) is held as an environment variable.

The compilation runs without error but when the application launches the error says "Unsupported 16-bit Application -  The programme or feature  cannot start or run due to imcompatibility with 64-bit versions of windows"

I understood that I could use the 32 bit version of the compiler and run the application on a 64 bit pc - but not the other way round?

One other fact is that I can compile and run the programme perfectly with gfortran.

Any help gratefully recieved.

John

0 Kudos
olslewfoot
Beginner
5,043 Views

Thanks TimP - but these editions are supported. The PC is almost new (3 months) and Visual studio 2010 and Intel fortran were purchased very recently specifically for the purpose of running these models. The only other fortran elements I have are gfortran - which I tried initially - but the intel version is required to run the model in parallel - hence my purchase.

0 Kudos
SergeyKostrov
Valued Contributor II
5,043 Views
>>...It seems unlikely that supported versions of Visual Studio or Intel compilers could produce a 16-bit application... Absolutely impossible for all recent Visual Studios and C++ compilers. >>...I understood that I could use the 32 bit version of the compiler and run the application on a 64 bit pc - but not the other way round? Yes, that is correct. You can not execute any 64-bit applications on 32-bit Windows platforms. PS: Here is a historical overview: Microsoft released last 16-bit compiler, that is Visual C++ v1.5 ( for DOS and Win16 ), some time between 1990 and 1992 and I used it for two years until June 1994 ( two months before Windows 95 was released ) when all our C/C++ developments were moved to Visual C++ v2.1 ( Win32 only ).
0 Kudos
Bernard
Valued Contributor I
5,044 Views

64-bit Windows will also not run any 16-bit application.32 bit Windows will run 16-bit app by executing it inside ntvdm process.

0 Kudos
SergeyKostrov
Valued Contributor II
5,044 Views
>>...32 bit Windows will run 16-bit app by executing it inside ntvdm process... I don't see any relevance of that knowledge demonstration statement. Is that related to the problem described in the original post? I don't think that Fortran developers are really interested to know if some application is executed inside of ntvdm process or outside.
0 Kudos
Bernard
Valued Contributor I
5,044 Views

Hi Sergey

and how  historical overview of Microsoft 16-bit C/C++ compilers is relevant to fortran developers.

0 Kudos
SergeyKostrov
Valued Contributor II
5,044 Views
>>...how historical overview of Microsoft 16-bit C/C++ compilers is relevant to fortran developers... It looks like you really have nothing else to do and continue commenting, commenting and commenting, when discussion is actually over.
0 Kudos
IanH
Honored Contributor III
5,044 Views

olslewfoot wrote:

The programme I'm compiling is in Fortran 95 and is a numerical hydrodynamic model. Its part of a suite of models the workflow for which is controlled by a python script - (the model suite is platform independent on windows or linux using this method).

The compiler call is to ifort.exe and the path to the compiler (in my case C:\Program Files (x86)\Intel\Composer XE 2013\bin\ia32) is held as an environment variable.

The compilation runs without error but when the application launches the error says "Unsupported 16-bit Application -  The programme or feature  cannot start or run due to imcompatibility with 64-bit versions of windows"

Could you please provide details (the more detail the better) about how you actually compile the application, and how you run it?  Are you compiling and running from the command line or from within Visual Studio?

0 Kudos
olslewfoot
Beginner
5,044 Views

Hi IanH

The program is compiled from the command line. It is a hydrodynamic model (telemac) which uses standard compiled executables unless you wish to change the simulation code in which case your own code for a changed subroutine is added and recompiled at runtime.

It is after the successful compilation of the changed code that the new executable launches but then fails with the 16 bit message.

Since the last post I have tested VS2010 and it builds and compiles projects perfectly well. So not at fault I believe.

Command line compiler (ifort) doesn't work at the moment as a library is not included  to link (ifconsole.lib).

So this leads me to believe that there must be something in my application causing this, but I'm at a loss to find it at present. The code has been developed over several years. When I compile with gfortran it works perfectly.

John

0 Kudos
olslewfoot
Beginner
5,044 Views

Hi IanH

The program is compiled from the command line. It is a hydrodynamic model (telemac) which uses standard compiled executables unless you wish to change the simulation code in which case your own code for a changed subroutine is added and recompiled at runtime.

It is after the successful compilation of the changed code that the new executable launches but then fails with the 16 bit message.

Since the last post I have tested VS2010 and it builds and compiles projects perfectly well. So not at fault I believe.

Command line compiler (ifort) doesn't work at the moment as a library is not included  to link (ifconsole.lib).

So this leads me to believe that there must be something in my application causing this, but I'm at a loss to find it at present. The code has been developed over several years. When I compile with gfortran it works perfectly.

John

0 Kudos
John_Campbell
New Contributor II
5,044 Views

You should do a search for program.*; like dir c:\program.* /s.
I would suspect there is a legacy "program.com" in the path list which is clashing with your program.exe

John

0 Kudos
jimdempseyatthecove
Honored Contributor III
5,043 Views

Let's start simple.

Write a "Hello World" application using the memory model of choice (32-bit). Test to see if this runs.
Add command line options that you wish to use with your application, build, test to see if this runs.
Add the libraries and modify the INCLUDE, etc to that of your problematic program, build, test to see if it runs.
Add the .obj files from your problematic program (excepting for .obj containing PROGRAM), build, test to see if it runs.
Change "PROGRAM" in your helloworld to SUBROUTINE, add your problematic program's .obj containing PROGRAM, test.

The error should creep in at some point in the genisis of the above process. If at the end of the above, you end up with a working program (althouth the name is different), then suspect a VS Solution/Project issue.

Jim Dempsey

0 Kudos
IanH
Honored Contributor III
5,043 Views

Separate to the reasonable sugestions from others - please give us a lot more detail.  Show things like the actual command lines used to build the application, the actual command lines used to invoke the application.  Show the actual texts of errors messages.  Consider attaching the build script.  Consider attaching source!  Otherwise we're guessing.

"Command line compiler doesn't work at the moment..." - this seems odd - do you know/understand what the problem is?  If not, details!

0 Kudos
olslewfoot
Beginner
5,044 Views

Hi

Have used a hello world version and it compiles and runs through VS2010 - so the installation seems to work fine. Tried other fortran applications also.

The command line version does not link - when I compile a source code it fails to link:

C:\Users\jb16\Documents\bin\fortran>ifort hello_world.f
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 1
3.1.1.171 Build 20130313
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:hello_world.exe
-subsystem:console
hello_world.obj
LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'

This library is in C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib\ia32

Can you advise settings to fix this please?

my path is:

Path=C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\m
pirt;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\c
ompiler;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32\m
pirt;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32\comp
iler;C:\Python27\Lib\site-packages\PyQt4;C:\Program Files (x86)\TRIM Context\;C:
\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Window
sPowerShell\v1.0\;C:\Program Files (x86)\Enterprise Vault\EVClient\;C:\Python27;
C:\Python27\DLLs;C:\Python27\Scripts;C:\Python27\Lib\site-packages\vtk;C:\Python
27\gnuplot\binary;C:\Program Files (x86)\pythonxy\SciTE-3.2.2-1;C:\Program Files
 (x86)\pythonxy\console;C:\Program Files\SlikSvn\bin;C:\Program Files\TortoiseSV
N\bin;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Fil
es\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\10
0\DTS\Binn\;C:\Program Files (x86)\MATLAB\MATLAB Compiler Runtime\v711\runtime\w
in32;C:\Program Files (x86)\Bitvise SSH Client;c:\MinGW\bin;c:\opentelemac\v6p2r
1\pytel;C:\Python27\Scripts;c:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Progr
am Files (x86)\Intel\Composer XE 2013\bin\ia32;C:\MinGW\bin;C:\Program Files (x8
6)\Microsoft Visual Studio 10.0\VC\bin;C:\Program Files (x86)\Microsoft Visual S
tudio 10.0\Common7\IDE

Thanks for looking at this.

JOhn

0 Kudos
IanH
Honored Contributor III
5,044 Views

Ok - that's a symptom of running the command line compiler from an environment that is not fully configured (specifically the LIB environment variable not including the directories with the intel libraries). 

Try again (both this simple program and perhaps your original problem) but using the command prompt under Programs > Intel Parallel Studio XE 2013 > Command Prompt > Parallel Studio XE with Intel Compiler XE 13.1 > IA-32 Visual Studio 2010 mode.  Folder names may vary depending on the specific compiler related products that you have installed - you should also find the Intel 64 prompt in there too and you may want to use that instead.

(That command prompt has a number of environment variables set up correctly for a particular version of the compiler.  Those environment variables can also be set up by calling the C:\Program Files\Intel\Composer XE\bin\compilervars.bat file.)

0 Kudos
olslewfoot
Beginner
5,044 Views

Hi IanH

That makes sense - have used the command prompt under parallel studio XE 2013 as you suggest and it fails to link while searching for a different library LIBCMT.lib but this doesn't exist on a search?

John

C:\Users\jb16\Documents\bin\fortran>ifort hello_world.f
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 1
3.1.1.171 Build 20130313
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:hello_world.exe
-subsystem:console
hello_world.obj
LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'

0 Kudos
IanH
Honored Contributor III
5,044 Views

That's a variant of the C runtime that should be picked up from your Visual Studio installation.  I'm wondering whether you are missing a required part of the installation of Visual Studio (or perhaps you have something that is conflicting with that installation).  Did you purcahse and install Visual Studio separately, or are you using the "shell" edition that is included with ifort?

What's the value of the LIB environment variable inside that command prompt?

0 Kudos
SergeyKostrov
Valued Contributor II
4,794 Views
>>...That's a variant of the C runtime that should be picked up from your Visual Studio installation... I'd like to add that in case of pure C/C++ application it needs to be fixed with /MD or /MDd switch ( or similar for different threading models ). I'm Not sure that it is applicable in case if ifort.exe and please take a look at command line options. If it doesn't help than follow Ian's suggestions.
0 Kudos
Reply