Eclipse Error Undefined Reference To Winmain 16
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business linker error undefined reference to winmain 16 dev c++ Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation undefined reference to winmain 16 code blocks c++ Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like
Sdl Undefined Reference To Winmain 16
you, helping each other. Join them; it only takes a minute: Sign up Undefined reference to 'WinMain@16' C error up vote 2 down vote favorite I am using Eclipse (C programming) and I have come up with
Undefined Reference To Winmain 16 Mingw
this code but every time I build it, I get the error saying, "Undefined Reference to 'WinMain@16'". I have spent over 2 hours trying to solve this problem but I can't figure out my where my error is. Can anyone help? This is the code: #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company
What Does Undefined Reference To Winmain 16 Mean
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions undefined reference to winmain mingw Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million undefined reference to winmain c programmers, just like you, helping each other. Join them; it only takes a minute: Sign up undefined reference to WinMain Error 1 in eclipse using mingw up vote 1 down vote favorite 1 Build of configuration Debug http://stackoverflow.com/questions/13459912/undefined-reference-to-winmain16-c-error 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 http://stackoverflow.com/questions/2040730/undefined-reference-to-winmain-error-1-in-eclipse-using-mingw help me yours faithfully, r.kranthikumar eclipse share|improve this question edited Jan 13 '10 at 8:22 Jeff Atwood♦ 39.1k41131145 asked Jan 11 '10 at 8:54 kranthikumar 752510 add a comment| 4 Answers 4 active oldest votes up vote 3 down vote 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) share|improve this answer answered Jan 11 '10 at 9:40 VonC 625k19017971882 See also yongshin.blogspot.com/2005/11/… –VonC Jan 11 '10 at 9:46 add a comment| up vote 2 down vote You're building a Windows Application, but you don't have a WinMain that is required by Windows applications. Likely, you have a main instead. You'll need to either change your project settings (to something along the lines of "Console Application"), or use WinMain instead. You likely want the former. Note, WinMain is not standard. This is just the Windows linkage requirement. share|improve this answer answered Jan 12 '10 at 4:23 GManNickG 231k29346470 add a comment| up vote 2 down vote (Is this a duplicate?) You could kee
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company http://stackoverflow.com/questions/3269112/eclipse-cdt-mingw-windows-error-undefined-reference-to-winmain16-on-b Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million https://www.daniweb.com/programming/software-development/threads/456721/undefined-reference-to-winmain-16-error programmers, just like you, helping each other. Join them; it only takes a minute: Sign up eclipse + cdt + mingw + windows error “undefined reference to `WinMain@16'” on build up vote 0 down vote favorite I undefined reference installed eclipse, cdt and mingw on my windows XP machine. added C:\MinGW\bin to my PATH. Created a new c++ project, with one file in it, test.c. the code in it: int main(){ int i=1; } Trying to build, I get the error: /mingw/lib/libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to 'WinMain@16' Notice it's not complaining about test.c but rather about some main.c in one of mingw's libs. What am I doing wrong? windows eclipse mingw cdt share|improve this undefined reference to question asked Jul 16 '10 at 21:50 olamundo 6,5102074123 Do you have the command line which is being used to invoke compiler available? Your problem appears to be one of linking, not compilation. (Perhaps you're missing a link to libmsvcrt.a) –Mark H Jul 16 '10 at 22:06 @Mark - thanks, I failed to notice that compile and linkage commands are trying to compile a different file than the one that contains the main –olamundo Jul 16 '10 at 22:20 add a comment| 3 Answers 3 active oldest votes up vote 3 down vote You need to save the .c file first. share|improve this answer edited Jan 4 '12 at 21:24 PeeHaa 40.7k33134216 answered Jan 4 '12 at 21:03 Gregory 312 add a comment| up vote 1 down vote accepted well, the solution was really weird, but I guess it would make sense to someone more proficient with CDT than me - My main() was inside a .c file. When I changed the suffix to be .cpp, it worked like a charm. share|improve this answer answered Jul 17 '10 at 10:51 olamundo 6,5102074123 1 Perhaps since you created a "C++ Project" CDT did not consider the .c file part of it. –Adam Mitz Jul 17 '10 at 14:24 The exact opposite happened to
to `WinMain@16' - Error 4Contributors 6Replies 21Views 3 YearsDiscussion Span 2 Years Ago Last Post by Ancient Dragon 0 3 Years Ago Trying to compile an Fast Light Tool Kit project for the first time. This is one I've generated in FLUID and dragged into Code::Blocks IDE (MinGW compiler). Not sure what this error means or how to fix it but it seems that it's very common? Any clues as to what it means. Thanks The error is below. Build started on: 16-06-2013 at 00:32.23 Build ended on: 16-06-2013 at 00:32.23 -------------- Build: Release in testfluid (compiler: GNU GCC Compiler)--------------- mingw32-g++.exe -LC:\fltk-1.3.2\lib -LC:\WINDOWS\system32\gdi32.dll -o bin\Release\testfluid.exe obj\Release\main.o -lfltk -lole32 -luuid -lcomctl32 -lwsock32 -lm -lgdi32 -luser32 -lkernel32 -lmingw32 C:\fltk-1.3.2\lib\libfltk.a C:\fltk-1.3.2\lib\libfltk_forms.a C:\fltk-1.3.2\lib\libfltk_gl.a C:\fltk-1.3.2\lib\libfltk_images.a C:\fltk-1.3.2\lib\libfltk_jpeg.a C:\fltk-1.3.2\lib\libfltk_png.a C:\fltk-1.3.2\lib\libfltk_z.a C:\WINDOWS\system32\gdi32.dll -mwindows c:/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 1 errors, 0 warnings (0 minutes, 0 seconds) christinetom 73 posts since Oct 2012 Community Member c++ Ask a Different Question 0 Ancient Dragon 5,243 3 Years Ago Sounds like you created a windows console program but attempting to compile a Windows win32 api GUI program. win32 api programs have WinMain() instead of main() as in console programs. 0 Discussion Starter christinetom 3 Years Ago Err, my mistake. I thought I had seen this error before. I forgot to add the sourcefile with the main function in it. Well, if the moderators want to delete this entire thread then feel free. Hope I didn't ruin anyones day. 0 Ancient Dragon 5,243 3 Years Ago No, you didn't ruin my day :) Just mark the thread Solved and everything will be ok. 0 Lucaci Andrew 140 3 Years Ago WinMain@16 usually apears when you tr