Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
338 Views

warning #5117: Bad # preprocessor line and fatal error LNK1107

Hello,

When I compile ansys demo function ResRd Demo.F against its binlib.dll using ifort compiler,

warning #5117: Bad#proprocessor line and fatal error LNK1107 happen. Detailed are in attachment.

Is there something more I can do? Am I getting the flags wrong?

Thanks,

Song

0 Kudos
15 Replies
Highlighted
Valued Contributor I
338 Views

This should have been posed to the Windows forum, but I think you are confusing compilation and linking steps. You want to compile your demo file into an object file before linking it with an external library.

0 Kudos
Highlighted
Black Belt Retired Employee
338 Views

In addition, you need to add /fpp for #include lines to be recognized.

0 Kudos
Highlighted
Beginner
338 Views

Hello Steve and Juergen, Thank you so much for your responses. I appreciate it. I am new with ifort. This is the first time I use it. Should I do compilation and linking in two separate steps (compile ResRdDemo.F into ResRdDemo.o and then link it to the binlib.dll)? if yes, what are correct commands? But when I try a command: "ifort /fpp ResRdDemo.F", output is as follows: c:\Users\User\Desktop\bao\ansys\binlib\ifort-replyed>ifort /fpp ResRdDemo.F Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R ) 64, Version 18.0.5.274 Build 20180823 Copyright (C) 1985-2018 Intel Corporation. All rights reserved. computer.h(174): #warning: keyword redefined: FUNCTION computer.h(175): #warning: keyword redefined: SUBROUTINE .\impcom.inc(18): error #5082: Syntax error, found IDENTIFIER 'UNDEFINED' when e xpecting one of: NONE TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE DOUB LECOMPLEX ... implicit undefined (a-z) ---------------^ .\impcom.inc(18): error #5136: Illegal syntax for IMPLICIT NONE statement. implicit undefined (a-z) -------------------------^ .\impcom.inc(70): error #5082: Syntax error, found ',' when expecting one of: => = . [ % ( : LONGINT BIGINT8,SMALLINT8,INT8_2,INT8_62, ---------------------^ .\impcom.inc(100): error #5082: Syntax error, found ',' when expecting one of: = > = . [ % ( : PTRFTN PTRFTNNULL, PTRZERO ---------------------------^ .\impcom.inc(101): error #6236: A specification statement cannot appear in the e xecutable section. parameter (HEAPPTRNULL = SMALLINT+2, ------^ .\impcom.inc(109): error #6236: A specification statement cannot appear in the e xecutable section. integer EXPON, NEXPON ------^ .\impcom.inc(110): error #6236: A specification statement cannot appear in the e xecutable section. parameter (EXPON=100, NEXPON=-100) ------^ .\impcom.inc(111): error #6236: A specification statement cannot appear in the e xecutable section. double precision TINY, HUGE ------^ .\impcom.inc(112): error #6236: A specification statement cannot appear in the e xecutable section. parameter ( TINY=2.0d0**NEXPON, HUGE=2.0d0**EXPON ) ------^ ResRdDemo.F(7): error #6236: A specification statement cannot appear in the exec utable section. external ResRdBegin, ResRdGeomBegin, ResRdGeomEnd, ------^ ResRdDemo.F(22): error #6236: A specification statement cannot appear in the exe cutable section. integer ResRdBegin, ResRdType, ResRdReal, ResRdCsys, ------^ ResRdDemo.F(30): error #6236: A specification statement cannot appear in the exe cutable section. integer MAXDOFSPERNODE, MAXNODESPERELEM, MAXREALS, MAXELERECORD ------^ ResRdDemo.F(31): error #6236: A specification statement cannot appear in the exe cutable section. parameter (MAXDOFSPERNODE=32, MAXNODESPERELEM=24, MAXREALS=100, ------^ ResRdDemo.F(34): error #6236: A specification statement cannot appear in the exe cutable section. integer Nunit,Lunit,Units,NumDof,DOF(MAXDOFSPERNODE),UserCode, ------^ ResRdDemo.F(39): error #6236: A specification statement cannot appear in the exe cutable section. integer ielc(200), i, j, k, n, kerr, nodes(MAXNODESPERELEM), ------^ ResRdDemo.F(42): error #6236: A specification statement cannot appear in the exe cutable section. character*4 DofLab(MAXDOFSPERNODE) ------^ ResRdDemo.F(43): error #6236: A specification statement cannot appear in the exe cutable section. character*32 JobName ------^ ResRdDemo.F(44): error #6236: A specification statement cannot appear in the exe cutable section. character*12 Fname ------^ ResRdDemo.F(45): error #6236: A specification statement cannot appear in the exe cutable section. character*80 Title(5) ------^ ResRdDemo.F(46): error #6236: A specification statement cannot appear in the exe cutable section. double precision Rcon(MAXREALS), xyz(6), time, ------^ ResRdDemo.F(49): error #6236: A specification statement cannot appear in the exe cutable section. character*3 EstrLab(25) ------^ ResRdDemo.F(50): error #6946: In this DATA statement, there are more values assi gned to variables then there are variables. There must be the same number of va lues and variables. ['ENF'] data EstrLab /'EMS','ENF','ENS','ENG','EGR', --------------------------^ .\impcom.inc(100): error #6793: The POINTER attribute is required. [PTRFTNPTRF TNNULL] PTRFTN PTRFTNNULL, PTRZERO ------^ ResRdDemo.F(58): warning #6043: This Hollerith or character constant is too long and cannot be used in the current numeric context. ['test.rst'] Fname = 'test.rst' --------------^ ResRdDemo.F(131): error #6410: This name has not been declared as an array or a function. [RCON] write (*,3023) i,n,(Rcon(j),j=1,n) --------------------------------^ ResRdDemo.F(163): error #6423: This name has already been used as an external fu nction name. [XYZ] write (*,3041) n,xyz -----------------------------^ ResRdDemo.F(189): error #6410: This name has not been declared as an array or a function. [NODES] write (*,3052) (nodes(j),j=1,n) ----------------------------^ ResRdDemo.F(278): error #6423: This name has already been used as an external fu nction name. [VALUES] write (*,3078) i,j,values ----------------------------------------^ ResRdDemo.F(327): error #6410: This name has not been declared as an array or a function. [ESTRLAB] write (*,9400) EstrLab(j),k,MAXELERECORD ---------------------------------------^ compilation aborted for ResRdDemo.F (code 1) When I try a command: "ifort /fpp ResRdDemo.F binlib.dll", output is as follows. Obviously, appending binlib.dll is incorrect. c:\Users\User\Desktop\bao\ansys\binlib\ifort-replyed>ifort /fpp ResRdDemo.F binl ib.dll Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R ) 64, Version 18.0.5.274 Build 20180823 Copyright (C) 1985-2018 Intel Corporation. All rights reserved. ifort: command line warning #10161: unrecognized source type 'binlib.dll'; objec t file assumed computer.h(174): #warning: keyword redefined: FUNCTION computer.h(175): #warning: keyword redefined: SUBROUTINE .\impcom.inc(18): error #5082: Syntax error, found IDENTIFIER 'UNDEFINED' when e xpecting one of: NONE TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE DOUB LECOMPLEX ... implicit undefined (a-z) ---------------^ .\impcom.inc(18): error #5136: Illegal syntax for IMPLICIT NONE statement. implicit undefined (a-z) ...... Can you please show me a correct command line for this case? Thank you once again, Song
0 Kudos
Highlighted
Valued Contributor I
338 Views

Without the source code it is not possible to really help you. A quick google search did not give links to the code you mentioned.

0 Kudos
Highlighted
Beginner
338 Views

Hello Juergen, Thank you for your quick reply. I really appreciate it. Source code is attached. Song

0 Kudos
Highlighted
Valued Contributor I
338 Views

Ok, implicit undefined in impcom.inc is not valid Fortran. Maybe it is some extension for which you need to set a flag. When you try to find it, it could possibly be an Oracle extension or a VMS extension to F77, there could be a flag for the compiler to accept it, but neither gfortran, nor ifort nor nagfor accept it.

0 Kudos
Highlighted
Black Belt Retired Employee
338 Views

IMPLICIT UNDEFINED is not supported by Intel Fortran. I had never heard of it before - definitely not VMS. Interesting that the compiler recognizes it enough to give you the error, though. IMPLICIT NONE (without the letter range) is the correct syntax.

0 Kudos
Highlighted
Beginner
338 Views

Hello Steve and Juergen,

Thanks for your responses. I absolutely believe that you are Drs. Fortran. Although I use ifort first time and I just join this forum for less than two days, I saw that both of you have resolved many of issues on this forum before.  Before I join this forum, I have searched on implicit undefined (a-z). I just found oracle fortran 77 mentioned this (https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vn9v/index.html). I agree with you that implicit none is the correct syntax. Interesting that ifort compiler does not support implicit undefined(a-z) and ansys uses ifort compiler, how ansys passes its compilation. I also agree that it is some extension for setting a flag. My question is What flag for ifort compiler accept it? 

Song

0 Kudos
Highlighted
Valued Contributor I
338 Views

Dear Song,

thanks for the flowers, but I am convinced that it is hubris to see myself mentioned in the same league with Steve. I would consider myself only as a gifted amateur.

Cheers,

     Juergen

0 Kudos
Highlighted
Black Belt Retired Employee
338 Views

I got the source to compile. Here's what I did:

In inpcom.h, replaced the invalid IMPLICIT lines with IMPLICIT NONE

Added the options:

/fpp /DPCWINNT_SYS /DSYSTEM_FLOAT_H

I don't know what SYSTEM_FLOAT_H means here, just that defining it means that it doesn't look for a float.h that was not provided.

0 Kudos
Highlighted
Beginner
338 Views

Hello Steve and Juergen,

Thank both of you so much. I really appreciate your help. According to Steve's instruction, the problem is resolved. In addition, as Juergen pointed out that I confuse the compilation and linking. please allow me to have a naïve question: Can I use /link option directly link to binlib.dll with ifort? I try it and failed. So I convert a dll to a lib and then compile them. Furthermore, I also try gfortran. gfortran compiles it successfully via converting functions to small cases and appending underscore . When running the exe file created by gfortran, it fails to load functions. I saw somewhere that ifort and gfortran are compatible. maybe it is incorrect.

thank you once again.

Song  

0 Kudos
Highlighted
Valued Contributor I
338 Views

Song, gfortran and Ifort libraries are not binary-compatible.

0 Kudos
Highlighted
Beginner
338 Views

Hello Juergen,

Thanks. Is there any means to covert libraries each other, for example, from *.dll to *.a and vice versa. 

Song

0 Kudos
Highlighted
Black Belt Retired Employee
338 Views

You're using Windows, so a static library is a .lib, not a .a. Please ask your new question in the WIndows forum. It has an answer, but it's not appropriate to prolong the unrelated discussion here.

0 Kudos
Highlighted
Beginner
338 Views

Sorry for I have found Windows forum before.

0 Kudos