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

Syntax error due to '&' "when expecting one of: <IDENTIFIER>

Erik_T_
Beginner
846 Views

I have written a small parent/child program structure that makes use of ZeroMQ and OpenMP. Until recently I have used gfortran to compile the program but I am now moving to iFort. The code can be found here. However, when compiling using the following makefile (not currently in the repository):

FC=ifort -O2 -openmp
LIBS=libf77zmq.a -lzmq 

EXE=hwserver hwclient

.PHONY: default

default: $(EXE)

%: %.f f77_zmq.h libf77zmq.a
	$(FC) $*.f -o $@ $(LIBS) -ffree-form

clean:
	$(RM) -f -- $(EXE) *.ipc

I get plenty of errors regarding ampersands. gfortran complained some about them as well, but they only resulted in warnings. A snippet of the output looks as follows:

ifort -02 -openmp hwserver.f -o hwserver libf77zmq.a -lzmq
fortcom: Error: solve.i, line 324: Syntax error, found '&' when expecting one of: <IDENTIFIER>
        PARAMETER ( INTS_WORDS = 1, &
------------------------------------------------------^
fortcom: Error: solve.i, line 325: Syntax error, found '&' when expecting one of: <IDENTIFIER>
        &           REALS_WORDS = 2, &
------------------------------------------------------^

and so it goes on...

I have understood that this is likely caused by ZeroMQ making use of Fortran77 standards, but as aforementioned this turned out to not be a problem when I used gfortran. Fully aware that it might come down to me having to rewrite the ZMQ-bindings, I would like to hear from you first to see if there's another way.

 

Regards

0 Kudos
1 Solution
Lorri_M_Intel
Employee
846 Views

Add -free to your ifort command line.

That's our equivalent to the gfortran -ffree-form.

                     --Lorri

View solution in original post

0 Kudos
2 Replies
Lorri_M_Intel
Employee
847 Views

Add -free to your ifort command line.

That's our equivalent to the gfortran -ffree-form.

                     --Lorri

0 Kudos
Erik_T_
Beginner
846 Views

Lorri Menard (Intel) wrote:

Add -free to your ifort command line.

That's our equivalent to the gfortran -ffree-form.

                     --Lorri

Thank you Lorri, this solved the ampersand problem! The compilation now exits with only warnings.

0 Kudos
Reply