Linker Error Undefined Reference To Winmain
files, but I didn't figure out how I can make the main program work. The errors that appear (when I try to compile the source files) are: 1. median.cpp 1
2
[Linker error] undefined reference to `WinMain@16' ld returned 1 exit status 2. grade.cpp 1
2
3
[Linker error] undefined reference to `median(std::vector<double, std::allocator<double> >)' [Linker error] undefined reference to `WinMain@16' ld returned 1 exit status 3. student_info.cpp 1
2
[Linker error] undefined reference to `WinMain@16' ld returned 1 exit status 4. 4_data_headers_partitioning.cpp (the main program) 1
2
3
4
[Linker error] undefined reference to `read(std::istream&, Student_info&)' [Linker error] undefined reference to `compare(Student_info const&, Student_info const&)' [Linker error] undefined reference to `grade(Student_info const&)' ld returned 1 exit status I attached the source files here: http://www.2shared.com/file/US8dNvZz/partitioning.html Can you help me a little? What I do wrong? Or what I omit? Thanks in advance for your help. (I'm using dev c++ 4.9.9.2 under windows) Jun 19, 2010 at 1:14pm UTC magnificence7 (188) I can't find where to download your files, maybe posting it helps? Anyway, are you sure you've compiled all your source files before linking? Jun 20, 2010 at 1:55am UTC Zhuge (4639) It seems like you are trying to compile all the cpp files as separate programs (hence, looking for WinMain in the other cpps). I don't know how dev c++ works, but there is probably a way to specify a "project" or something that indicates that your files are together a single program. Jun 20, 2010 at 1:56pm UTC Duoas (10453) Yes, start Dev-C++ and create a new Project. Add your main program's cpp file, then add the other cpp files you intend to use in your project. Make sure you create a "Console Application" project -- not a Windows (GUI) application project. Then use Dev-C++ to compile the whole project. Good luck! Jun 24, 2010 at 6:42am UTC adny (10) I added the files into a new project (console application). But again a new error [Build Error] No rule to make target... - I solved that by changing project's path. It seems Dev-C++ has some problem with paths and spaces. I compiled the project (I also compiled every file it contains) and everything was ok, Done. with no errors. But w
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 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 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How do I solve the following errors: “Undefined reference to WinMain”, “[Error] Id returned 1 exit status”? [duplicate] up vote http://www.cplusplus.com/forum/beginner/25188/ 0 down vote favorite This question already has an answer here: undefined reference to `WinMain@16' 4 answers I'm writing a C program and using Dev C++ to compile/run it. However, it's coming up with the error: undefined reference to 'WinMain'" and "[Error] Id returned 1 exit status" What do these errors mean, and how do I solve them? The WinMain error appears to be linked to line 18 of my code which is... int http://stackoverflow.com/questions/26470353/how-do-i-solve-the-following-errors-undefined-reference-to-winmain-error read_char() { return getchar(); } Any ideas? I'm a beginner with C, and I haven't found an answer to this question that I understand. I presume it's because I'm using Windows. Would the code work on linux as it is perhaps? c dev-c++ share|improve this question edited Oct 20 '14 at 16:32 David Heffernan 431k27585952 asked Oct 20 '14 at 16:23 Wolff 159213 marked as duplicate by Deduplicator, JasonMArcher, James Kingsbery, cpburnz, IdeaHat Oct 20 '14 at 18:24 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. I don't know "Dev C++" but shou should probably start a "Windows console" project or something like this. –Michael Walz Oct 20 '14 at 16:25 How are you going to use getchar() function in window? –Seprum Oct 20 '14 at 16:29 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote This error means that the linker is looking for a function named WinMain to use as the entry point. It would be doing that because you configured the project to target the GUI subsystem, but did not provide a WinMain function. My guess is that you want to produce a console application and have provided
Support Guy, we highly recommend that you visit our Guide for New Members. Solved: https://forums.techguy.org/threads/solved-dev-c-linker-error.461738/ Dev-C++ Linker Error Discussion in 'Software Development' started by lotuseclat79, Apr 23, 2006. Thread Status: Not open for further replies. Advertisement lotuseclat79 Thread Starter Joined: Sep 12, 2003 Messages: 20,583 Which library does a Dev-C++ compiled program have to link with to resolve the following [Linker error]: undefined reference to '[emailprotected]' ld returned 1 exit linker error status when WinMain is clearly defined in the C++ source code as the name of main, using the Dev-C++ environment v4.9.9.2. and #include