|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Anonymous Guest
|
Posted: Wed Aug 10, 2005 7:25 am Post subject: Problem: FTN95, CFPP and INCLUDE files |
|
|
Hi,
I am trying to port an existing F95 scientific code using the personal edition of the salford compiler (prior to purchase). I have a problem with the CFPP. If I #define an expression in a file that is then INCLUDE'd (or #include'd) into a source file, the definition does not seem to be valid in the source file. Am I using the compiler incorrectly? To maintain cross-platform compatibility I must use the C-style pre-processor, and there is no way the code can be rewritten to avoid its use.
Thanks for any help,
Alistair.
P.S. A simple illustration of the problem is:
sourceB.f90:
PROGRAM sourceB
INCLUDE "sourceA.i"
#if defined (declarationA)
#warning "declarationA defined in sourceB.f90"
#else
#warning "declarationA NOT defined in sourceB.f90"
#endif
PRINT *,"A test"
END PROGRAM sourceB
sourceA.i:
#define declarationA
#if defined (declarationA)
#warning "declarationA defined in sourceA.i"
#else
#warning "declarationA NOT defined in sourceA.i"
#endif
On compilation (in a bash terminal under Cygwin on XP SP2):
> ftn95 sourceB.f90 /CFPP /LIST /LIST_INSERT_FILES
[FTN95/Win32 Ver. 4.8.0 Copyright (C) Salford Software Ltd 1993-2005]
0007) #warning "declarationA NOT defined in sourceB.f90"
WARNING - CFPP warning: "declarationA NOT defined in sourceB.f90"
WARNING - CFPP warning: "declarationA defined in sourceA.i"
NO ERRORS, 2 WARNINGS [<SOURCEB> FTN95/Win32 v4.8.0]
sourceB.lis:
Salford FTN95/WIN32 Ver 4.8.0 sourceB.F90 Wed Aug 10 13:53:23 2005
Compiler Options in Effect:
CFPP COLOUR DELETE_OBJ_ON_ERROR LIST LIST_INSERT_FILES MINIMISE_REBUILD NO_QUIT NON_STANDARD
SINGLE_THREADED
0001 PROGRAM sourceB AT 0
0002 INCLUDE "sourceA.i" AT 20
0003 AT 20
0004 AT 20
0005 AT 20
0006 AT 20
0007 AT 20
WARNING - CFPP warning: "declarationA NOT defined in sourceB.f90"
0008 AT 20
0009 AT 20
1/0001 AT 20
1/0002 AT 20
1/0003 AT 20
1/0004 AT 20
WARNING - CFPP warning: "declarationA defined in sourceA.i"
1/0005 AT 20
1/0006 AT 20
1/0007 AT 20
0010 PRINT *,"A test" AT 20
0011 END PROGRAM sourceB AT 60
End of Compilation - Clocked 0.04 seconds
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Thu Aug 11, 2005 1:37 am Post subject: Problem: FTN95, CFPP and INCLUDE files |
|
|
FTN95 does not provide a fully functional C preprocessor and you have hit upon one of its limitations.
At the moment #define must appear explicitly in the code.
Alternatively you could use /DEFINE on the command line. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|