Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
646 views
in Technique[技术] by (71.8m points)

undefined reference to WinMain Error 1 in eclipse using mingw

**** Build of configuration Debug for project testcase ****

make all 
Building target: testcase.exe
Invoking: MinGW C++ Linker
g++  -o"testcase.exe"  ./atest.o ./main.o  C:/cppunit/src/cppunit/.libs/libcppunit.a 
/mingw/lib/libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
make: *** [testcase.exe] Error 1

undefined reference to `WinMain@16' : mingw/lib/libmingw32.a(main.o):main.c:    
make: *** [testcase.exe] Error 1 

but am using an cpp program. in cpp program which has main.cpp, atestcase.cpp and a.hpp but it showing main.c:(.text+0xd2):

Can any one solve this problem .please can any one help me yours faithfully, r.kranthikumar

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First, check you did actually save your main.c file (eclipse does not automatically save a source file)

Then, check if your makefile is autogenerated or if you can write it yourself, as in this thread.

CXXFLAGS = -O2 -g -Wall -fmessage-length=0

OBJS =  main.o

LIBS =

TARGET =    say.exe

$(TARGET):  $(OBJS)
    $(CXX) -o $(TARGET) $(OBJS) $(LIBS)

all:    $(TARGET)

clean:
    rm -f $(OBJS) $(TARGET)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...