emacs 77: undefined reference to `main'
Good`aye
I am a student trying to compile a library file in emacs and get this error message. I can`t for the life of me see what is obviously an obvious error. Any help appreciated Michael the compile line I used is : g++ myMath.cpp -Wall -o myMath THE IMPLEMENTATION FILE ********************************************************************/ #include "myMath.h" int length(int i) { } doublele areaOfCircle(double r) { } AND THE HEADER ****************************************************/ #include <cmath> const double PI = 3.14159; int length(int i); // length of integer i double areaOfCircle(double r); // area of a circle with radius r. ERROR /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In function `_start': ../sysdeps/i386/elf/start.S:77: undefined reference to `main' collect2: ld returned 1 exit status Compilation exited abnormally with code 1 at Sun Sep 14 00:50:13[/I] |
Re: emacs 77: undefined reference to `main'
Quote:
Use: gcc -Wall -c -o myMath.o myMath.c After that, you can convert it to a static library with: ar crv libmyMath.a myMath.o After this you can use it with gcc's "-l myMath" (and "-L /directory/of/your/libmyMath)" option to use it in programs. (for dynamic libs I don't know...) |
re:emacs 77: undefined reference to `main'
Goodàye Hko
please excuse the tardiness of this reply. Thanks for your help, you helped clear up a missunderstanding of the use oc -c. Thanks again Michael |
All times are GMT -5. The time now is 12:46 PM. |