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

my error : unresolved external symbol _WinMain@16

mery592000
Beginner
2,749 Views

Hi , I have a purchased a source code from an university in usa.

this program consists of some FORTRAN programming files which would be compiled as one EXE file , running in command shell mode.

i'm not expert in fortran (visual fortran) and when i try to compile the program , i give this response :

--------------------Configuration: 4 - Win32 Debug--------------------
Compiling Fortran...
C: SourceIdmhys.for
C: SourceIDSHYS.for
C: SourceIDWRITE.for
C: SourceIDWAL.FOR
C: SourceIDTRN.FOR
C: SourceIDSYID.FOR
C: SourceIDSTORYSHEAR.for
C: SourceIDSTIFFMAT.for
C: SourceIDSTFF.for
C: SourceIDSTAT.for
C: SourceIDSPR.FOR
C: SourceIDSOLN.FOR
C: SourceIDSNAPSHOTS.for
C: SourceIDQUASI.FOR
C: SourceIDPLOT.for
C: SourceIDPLASROT.for
C: SourceIDOUTLOOPS.for
C: SourceIDMONO.FOR
C: SourceIDMOMCURV.for
C: SourceIDMODPUSH.for
C: SourceIDINFILL.for
C: SourceIDERR.FOR
C: SourceIDEIGEN.for
C: SourceIDEDG.FOR
C: SourceIDDYNA.FOR
C: SourceIDDSTE.FOR
C: SourceIDDMGE.FOR
C: SourceIDDINP.FOR
C: SourceIDDINI.FOR
C: SourceIDDAMPER.for
C: SourceIDCOL.FOR
C: SourceIDCNFG.FOR
C: SourceIDBEM.FOR
C: SourceIDAXHYS.FOR
C: SourceIDARC2D_5.for
C: SourceID_PM_INTERACTION.FOR
C: SourceID_PDELTA.for
C: SourceID_CHOL_DEC.for
Linking...
libc.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/4.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

4.exe - 2 error(s), 0 warning(s)
-----------------------------------------------------------------------------------------

i dont know what is the problem of LIBC.LIB which the error seems to be rised of that.

thanks if you can help me to compile the exe file .

i use win32 application for making the new project and i use DIGITAL FORTRAN Professional ver 5.0 A , in microsoft developer studio 97.

thanks

0 Kudos
13 Replies
anthonyrichards
New Contributor III
2,749 Views
I have a feeling you should make it a Fortran Console application. Also, try a global search of the Fortran files to seewhich or whether one of them containsa 'Program' statement.
0 Kudos
Steven_L_Intel1
Employee
2,749 Views
As Anthony suggested, you chose "Windows Application" where what you wanted was "Console Application". "Windows Application" requires that you write the code in a particular way with a WinMain entry point instead of a main program.
0 Kudos
mery592000
Beginner
2,749 Views

Hi all

thanks, your advise was useful , and i compiled my 1.EXE !

but there is an error and thats in behaviour of the 1.EXE file which differs from thestandard precompiled EXE file (purchased with source code.)

my compiled exe file has no display response and always intrrupts by an run time error :

"Forrtl : severe (24) : end-of-file during read, unit 1,file c: IDARC.DAT"

and this is the standard exe file response at same condition :

"

********************************************************

VERSION 5.5

Andrei Reinhorn

Rodolfo E. Valles

State Univ of New York at Buffalo

Collaborators:

S.K. Kunnath C. Li

A. Madan C. Ozer

Y. Reichman R.E. Valles

A. Vladescu

State Univ of New York at Buffalo

*************************************************************

and .....

"
and another point is the size of my compiled EXE file sizeis 1.20 MB ( after changing some seeting reduced from 1.38 MB) and standard EXE file size is 1.01 MB.

i dont know is it possible the source code has been altered for anyreasons or my visual fortran settings are not correctly defined?

I can send you the source code if you wish for more detailing.

please help me , thanks .

0 Kudos
Steven_L_Intel1
Employee
2,749 Views

Is c: IDARC.DAT the location of your data file? If it isn't, the default behavior would be to create an empty file there which would then get an end-of-file when read.

If you need more help, please submit a support request to Intel Premier Support and attach a ZIP file of your application (and data).

0 Kudos
mery592000
Beginner
2,749 Views

Thanks for your response.

the problem is not the C: IDARC.DAT . this file is a data which will be opend and contents of that would be read. I tested the STANDARD EXE file and my own COMPILED EXE file , at the SAMEcondition , so no difference would be available.

however I attached the source codesand STANDARD EXE file and the result of compilation would be the same as StANDARD EXE file .

at last , some points would be noticed :

1) may be the code has been altered or

2) my visual fortran settings are not set correctly or

3) this source is not intended to be compiled via visual fortran ( for example just by MS Power station fortran , & i dont know does it differ with visual fortran ?! )

and at last , I use visual fortran professional edition 5.0 A under microsft developer studio 97.

reallly thanks,

regards,hosseini

0 Kudos
Steven_L_Intel1
Employee
2,749 Views

Hmm - that's a nine-year-old compiler you're using...

I think my original guess was correct. If you're running the program under Visual Studio, it looks for the IDARC.DAT file in the project folder, the one containing the .DSP file. Since it opens the file STATUS='UNKNOWN', if the file does not already exist there, it creates a new, empty one. It then tries to read the file and gets an end of file.

I'll bet that if you look at the project folder you will find a zero-length IDARC.DAT file.

The solution is to go into the settings, Debug and change the default directory to be the one containing the real data files. Your program builds and runs fine for me in Intel Visual Fortran 9.1, and I don't see why it wouldn't in DVF 5.0A. DVF will complain about the $debug lines but you can ignore that.

0 Kudos
Steven_L_Intel1
Employee
2,749 Views
Looking again at what you wrote, I'm certain that's the problem. Note that the path in the error message says c: IDARC.DAT but your files are really in c: Samples. c: is your project folder.
0 Kudos
mery592000
Beginner
2,749 Views

Hi Dear Lionel.

thanks for your attention but there are some points :

I know the exe file tries to open IDARC.DAT at first to read its data and if IDARC.DAT is not found , it creates an empty IDARC.DAT.

that's true as you said , but i talk about if IDARC.DAT is found.

incontent of IDARC.DAT , theres name of another data file such as DATA.DAT

the file then tries to open DATA.DAT and analyse its data and provide out put file (DATA.OUT).

in this process , the program must provide an interface in a "DOS window", showing the progress of analysis.

the standard exe file, compiled by authors of source , act perfectly and shows an interface but mine exe file ,does'nt perform correctly!

I provide younew IDARC.DAT and a sample file (DATA.DAT) as are attached.

Icreated a new folders as "STANDARD" and "COMPILED". the common files in these two folders are :

  • IDARC.DAT
  • DATA.DAT

an additional file :

in STANDARD folder there is IDARC.EXE (compiled originally by authors of code)

in COMPILED folder there is 2.EXE (compiled by me )

Now , if my 2.EXE file is compiled correctly , should act the same az IDARC.EXE .

but as you see they dont act the same and i dont know what is the problem.

you can test your compiled EXE file by creating a new foder like "LIONEL" and copy data files ( IDARC.DAT , DATA.DAT) in created folder and copy your compiled EXE file in that ,too.

run your compiled exe file and compare the results with STANDARD folder's results( results= interface response , new out put file which would be created after running exe files , ...).

and at last , i would be thanksfull if you send me your compiled EXE file .

another thing ! please tell me what is Microsoft Power station fortran ? and is it possible compiling my source with that , yield a different EXE file ?

thanks .

Regards,Hossieni.

0 Kudos
mery592000
Beginner
2,749 Views

Hi Dear Lionel.

thanks for your attention but there are some points :

I know the exe file tries to open IDARC.DAT at first to read its data and if IDARC.DAT is not found , it creates an empty IDARC.DAT.

that's true as you said , but i talk about if IDARC.DAT is found.

incontent of IDARC.DAT , theres name of another data file such as DATA.DAT

the file then tries to open DATA.DAT and analyse its data and provide out put file (DATA.OUT).

in this process , the program must provide an interface in a "DOS window", showing the progress of analysis.

the standard exe file, compiled by authors of source , act perfectly and shows an interface but mine exe file ,does'nt perform correctly!

I provide younew IDARC.DAT and a sample file (DATA.DAT) as are attached.

Icreated a new folders as "STANDARD" and "COMPILED". the common files in these two folders are :

  • IDARC.DAT
  • DATA.DAT

an additional file :

in STANDARD folder there is IDARC.EXE (compiled originally by authors of code)

in COMPILED folder there is 2.EXE (compiled by me )

Now , if my 2.EXE file is compiled correctly , should act the same az IDARC.EXE .

but as you see they dont act the same and i dont know what is the problem.

you can test your compiled EXE file by creating a new foder like "LIONEL" and copy data files ( IDARC.DAT , DATA.DAT) in created folder and copy your compiled EXE file in that ,too.

run your compiled exe file and compare the results with STANDARD folder's results( results= interface response , new out put file which would be created after running exe files , ...).

and at last , i would be thanksfull if you send me your compiled EXE file .

another thing ! please tell me what is Microsoft Power station fortran ? and is it possible compiling my source with that , yield a different EXE file ?

thanks .

Regards,Hossieni.

0 Kudos
Steven_L_Intel1
Employee
2,749 Views

The program as I build it runs the same as the old one in that it displays some output to the screen, writes a file 1.out, then exits. If you run it in Developer Studio by starting it under the debugger, then it will exit when done and you may miss the output.

When I build and run with Intel Visual Fortran, the 1.out file shows an error as follows:

ERROR:

Phy Yield

**ERROR CHECKING SECTION PROPERTIES FOR ELEMENT 1

Since you aren't using our compiler, I'm not going to try to debug this further. The program as compiled by Intel Visual Fortran does run in the same manner as your supplied EXE.

Microsoft Fortran PowerStation was Microsoft's Fortran 90 compiler which they stopped selling in 1997.

0 Kudos
mery592000
Beginner
2,749 Views

Hi dear Lionel

thanks for your patient your answers.

I have no other question! and at last ,have a request .

I attached a zip file containing source code ( this source code differs from previous one because i changed some varibale dimentions in IDDEFN.FORto fit my needs).

I would be very thankful if you can compile it and attach the resultingEXE filein reply.

Really thanks.

Best regards , Hosseini

0 Kudos
Steven_L_Intel1
Employee
2,749 Views

Sorry, I won't do that. It wouldn't do you much good anyway as the program gets some sort of error while running. I think you can use the DVF 5.0 you have to build and debug it once you understand where it is looking for files.

0 Kudos
mery592000
Beginner
2,749 Views
thanks Mr Lionel
0 Kudos
Reply