0

I used the following:

gcc -c -O4 ab_test.c 

This worked and generated ab_test.o without error, but

gcc -o ab_test ab_test.o -lgsl -lgslcblas -lm 

lead to error as:

**/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/crt1.o: In function `_start':
/home/abuild/rpmbuild/BUILD/glibc-2.18/csu/../sysdeps/x86_64/start.S:118: undefined reference to `main'
collect2: error: ld returned 1 exit status**

The code is ab_test.c is as under

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>


Main()
{
  int i, temp_int;
  char amode[30];
  char bmode[30];
  float wave_vector_y;
for(i=0; i<41; i++)
    {
        //// set wave vector ////
        wave_vector_y = i*0.005;    

        temp_int = 10000*wave_vector_y;
        sprintf(amode,"a%04d.dat",temp_int);
        sprintf(bmode,"b%04d.dat",temp_int);
    }
}
Matt
  • 68,711
  • 7
  • 155
  • 158

1 Answers1

0

Your "main" signature should be something like int main(void)or int main(int argc ,char *argv[]) and not old C style syntax for int Main().

David Ranieri
  • 39,972
  • 7
  • 52
  • 94
Moshe Gottlieb
  • 3,963
  • 25
  • 41