kim@linc.cis.upenn.edu (JEE-IN KIM) (01/27/91)
Hi, I am trying to write a C++ program of an X-window application. The makefile for the program is at the end of this message. Unfortunately, it produces the following error message. ========== > make g++ -Wall -g -o gb -lXaw -lXmu -lXt -lX11 crt0.c:731: Undefined symbol _main referenced from text *** Error code 1 make: Fatal error: Command failed for target `gb' > ========== Could you please let me know what is wrong with my makefile? Please E-mail me. Thanks in advance. Jee-In ================================================================== BIN= /usr/local/bin INC= /usr/include/X11 /usr/local/lib/g++-include LIB = -lXaw -lXmu -lXt -lX11 C_FLAG= -Wall -g SRC= test.cc OBJ= test.o .c.o: g++ $(C_FLAG) -c $< gtest: g++ $(C_FLAG) -o $@ $(LIB) install: test cp test $(BIN)/gb depend: makedepend $(INC) $(SRC) clean: -rm *.o test *~ *bak core --------------------------- Jee-In Kim kim@unagi.cis.upenn.edu ---------------------------
mouse@lightning.mcrcim.mcgill.EDU (01/27/91)
> I am trying to write a C++ program of an X-window application. The > makefile for the program is at the end of this message. > Unfortunately, it produces the following error message. > > make > g++ -Wall -g -o gb -lXaw -lXmu -lXt -lX11 > crt0.c:731: Undefined symbol _main referenced from text > Could you please let me know what is wrong with my makefile? [relevant excerpt from Makefile] > gtest: > g++ $(C_FLAG) -o $@ $(LIB) This really is not an X problem; this is a basic compiler and/or make use problem. With the command I have quoted, g++ -Wall -g -o gb -lXaw -lXmu -lXt -lX11 you are telling g++ to link your object files together to form an executable called gb. However, you aren't giving it any object files to link together! Hardly surprising it doesn't like you. I don't quite know where the gb is coming from; $@ is supposed to be the target name, which would be gtest in this case. As a first guess at what you intend to do, I would propose > gtest: $(OBJ) > g++ $(C_FLAG) -o $@ $(OBJ) $(LIB) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu