Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

resolving _MAIN error 1

Status
Not open for further replies.

ArmenD

Programmer
Feb 3, 2005
101
US
anyone know how I can resolve this error

[armen@localhost abedi]$ g77 test.f -o test2 -Ijapi
Code:
/usr/lib/gcc/i386-redhat-linux/3.4.3/libfrtbegin.a(frtbegin.o)(.text+0x35): In function `main':
: undefined reference to `MAIN__'
collect2: ld returned 1 exit status
 
Try -l (lowercase L) instead of -I (uppercase i)
 
good point. but it still appears that "ld" cant find the package that i downloaded.

i am getting this error...
/usr/bin/ld: cannot find -ljapi
collect2: ld returned 1 exit status

"ld" appears to be a binary file, so i am not sure what to do next?
 
so any ideas as to what this _main error may be from?

Code:
./lib/gcc-lib/mingw32/3.2/../../../libfrtbegin.a(frtbegin.o.b)(.text+0x3a): undefined reference to
MAIN__'
 
You need to tell it where to find libjapi.a with a -L followed by the directory

Say libjapi.a lives in /home/japi/lib. Your compile line will look like
Code:
g77 test.f -o test2 -L/home/japi/lib -ljapi

Your main__ error seems to imply that there are two programs. Check your LD_LIBRARY_PATH environment variable. Make sure that the libraries are in the correct order.
 
the strange this is that I stripped all the JAPI code and I am still getting the undefined main error.

you see, the code without JAPI compiles fine, but when i try the -o option to create the executable, I get that error.
 
If you try it without the -o, the executable will be called a.out. Does that work?

Just a guess - try dropping the space between the -o and test2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top