* Errors in compilers?
@ 1997-11-11 21:11 yue-feng sun
0 siblings, 0 replies; only message in thread
From: yue-feng sun @ 1997-11-11 21:11 UTC (permalink / raw)
----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 36
Hello Redhat Tech. Support, Jay of Digital, and all,
Last year or so, I tried to install RedHat on my
Pentium. Everything was fine except that the linking (ld) of my
combined fortran (f77 or g77?), gcc, g++ programs could not
find the right references. I compiled each of them and finally
linked them by using command lines, it was fine. But if I used
Makefile, ld complained no references for some objective codes.
I then switched to Slackware Linux and everything was fine. I
have used Slackware Linux upto to now.
Recently, I consider to buy an alpha workstation and think
to install Redhat but I am not sure that this problem still
exists. Most of my programs use c++ programs for interface,
c programs for unix I/O, and fortran for double precison computation.
attached are four simple files, Makefile, cppmain.C, cstuff.c, and
fstuff.f. I can run them under Slackware Linux and SUN Solaris using
the gcc compilers.
If you can test your Redhat Linux using these programs on
a Pentium or an Alpha machine, or Jay can test them on the Alphas,
I could appreciate a lot. Please let me know. Thanks.
Yue-Feng Sun
Lamont Doherty Earth Observatory
of Columbia University
Palisades, NY 10964
USA
Tel: (914) 365-8504
FAX: (914) 365-3182
Email: sunyf@ldeo.columbia.edu
PS. 1. save the four files in a directory under Linux;
2. mv make.txt Makefile
3. type simptly make; if things are ok, an executible file cftest
will be the result.
----------
X-Sun-Data-Type: default
X-Sun-Data-Description: default
X-Sun-Data-Name: make.txt
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 52
#
# Y.F. Sun, sunyf@ldeo.columbia.edu
FLAGPLATFORM =
FFLAGS =
CFLAGS =
C++FLAGS = -O
INCDIRS =
CPP = g++
CC = gcc
FC = g77
LKL = g77
##### Local vairable definitions #####
PROG1 = cftest
OBJS1 = cppmain.o cstuff.o fstuff.o
PROGRAMS = $(PROG1)
FLAGS = $(FLAGPLATFORM) $(FFLAGS) $(CFLAGS) $(C++FLAGS)
LIBS =
##### Rules and their local targets #####
.c.o:
$(CC) -c $(INCDIRS) $(FLAGPLATFORM) $(CFLAGS) $<
.C.o:
$(CPP) -c $(INCDIRS) $(FLAGPLATFORM) $(C++FLAGS) $<
.f.o:
$(FC) -c $(INCDIRS) $(FFLAGS) $<
##### Rules and their goal targets #####
default:
make targets
targets: $(PROGRAMS)
$(PROG1): $(OBJS1)
$(LKL) $(FLAGS) -o $@ $(OBJS1) $(LIBS)
cleanall:
rm -f *.o *.a core $(PROGRAMS)
----------
X-Sun-Data-Type: default
X-Sun-Data-Description: default
X-Sun-Data-Name: cppmain.C
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 29
/* c2f.C, Y.F. Sun*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
extern "C" cprint(int , float *);
extern "C" void f2c_(int *, float *);
int main(int argc, char *argv[])
{
int dv1d;
float *v1df;
int i;
dv1d = 10;
v1df = (float *) malloc(dv1d*sizeof(float));
for(i=0; i< dv1d;i++) v1df[i] = i;
cprint(dv1d,v1df);
f2c_(&dv1d,v1df);
cprint(dv1d,v1df);
free ( (char *) v1df);
printf("done.\n");
}
----------
X-Sun-Data-Type: c-file
X-Sun-Data-Description: c-file
X-Sun-Data-Name: cstuff.c
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 23
/* cstuff.c, Y.F. Sun */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
void cprint(int lx, float *x)
{
int i;
for(i=0; i< lx;i++) printf("%d %f\n", i, x[i]);
printf("\n");
}
void fcallc_(int *lx,float *x)
{
int i;
for( i = 0; i < *lx; i++) x[i] += 1000.;
}
----------
X-Sun-Data-Type: default
X-Sun-Data-Description: default
X-Sun-Data-Name: fstuff.f
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 11
c Y.F. Sun
subroutine f2c(lx,x)
real x(*)
external fcallc
c
do i=1,lx
x(i) = x(i) + 100.
enddo
call fcallc(lx,x)
return
end
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-11-11 21:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-11-11 21:11 Errors in compilers? yue-feng sun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox