未定义引用WinMain错误1在eclipse中使用mingw [英] undefined reference to WinMain Error 1 in eclipse using mingw
问题描述
****构建配置调试项目testcase ****
**** 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
但是正在使用cpp程序。在cpp程序中有main.cpp,atestcase.cpp和a.hpp,但它显示main.c :( .text + 0xd2):
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):
可以解决这个问题.please可以任何人帮助我
你的忠实,
r.kranthikumar
Can any one solve this problem .please can any one help me yours faithfully, r.kranthikumar
推荐答案
首先,检查您实际上保存您的 main.c
文件(eclipse不会自动保存源文件)
First, check you did actually save your main.c
file (eclipse does not automatically save a source file)
然后,检查您的makefile是否自动生成,或者是否可以写就像这个线程一样。 p>
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)
这篇关于未定义引用WinMain错误1在eclipse中使用mingw的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!