Mingw frustrations

This is a discussion on Mingw frustrations within the C++ Programming forums, part of the General Programming Boards category; Everything I compile turns out with the same error, i have reinstalled the compiler with different revisions, installed it on ...

  1. #1
    Registered User
    Join Date
    May 2009
    Location
    Look in your attic, I am there...
    Posts
    92

    Angry Mingw frustrations

    Everything I compile turns out with the same error, i have reinstalled the compiler with different revisions, installed it on other windows computer and its the same over and over. I am on the verge of getting a mac...

    Code:
    /mingw/lib/libmingw32.a(main.o):main.c:(.text+0x104): undefined reference to `WinMain@16'
    all the code...

    Code:
    ================ READY ================
    g++ model.cpp -lglaux -lopengl32 -lglu32
    g++ model.cpp -lglaux -lopengl32 -lglu32
    Process started >>>
    C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccfZqWec.o:model.cpp:(.text+0x96c): undefined reference to `LoadGLTexture(char const*)'
    /mingw/lib/libmingw32.a(main.o):main.c:(.text+0x104): undefined reference to `WinMain@16'
    collect2: ld returned 1 exit status
    <<< Process finished.
    ================ READY ================
    A thankyou in advance for any help

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Do you have a WinMain function? If you intend to make a Windows program, why not? If you did not intend to make a Windows program, but just (say) a console program, why not set your compiler for "console application" (or similar)?

  3. #3
    Registered User
    Join Date
    May 2009
    Location
    Look in your attic, I am there...
    Posts
    92
    the file i am compiling doesnt have a winmain anywhere in it, i am using glut

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I seem to recall that you need more libraries than that. -lgdi32 at least, I think, and maybe something else that I don't recall.

    Also, while we're here, if you're using glut you'll also need the glut library, which is -lglut32 if I recall correctly.

  5. #5
    Registered User
    Join Date
    May 2009
    Location
    Look in your attic, I am there...
    Posts
    92
    Well, I am compiling the files for nehe tutorial lesson31 dev c++ in mingw to render md2 models. I am new to c++ and c compiling through command line (i am used to ada). I have been unable to compile any of the tutorials i have come across because of various errors. I have spent days looking for libraries and tutorials that i could get to compile with no luck.

    Also, none of them mention using gdi32... :/

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Tutorial 31 uses -mwindows -lglaux -lopengl32 -lglu32, which is probably neater all round than trying to figure out the right libraries. (As far as I can tell, the code doesn't use GLUT so it doesn't need that library.)

    If you had started nehe's tutorials at the beginning, they use the libraries -lopengl32 -lglu32 -lglaux -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32, which is way way way way way too many. I think -lgdi32 is the only one you actually need off the list that you're missing.

  7. #7
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    The project zip from the bottom of the page, with a fresh Dev-C++ install, works fine for me ("DOWNLOAD Dev C++ Code For This Lesson. ( Conversion by Warren Moore )"). The code shown on that page doesn't seem to be complete, or is apart of an ongoing project. The project downloads at the bottom work. These tutorials don't use GLUT by default though, so they have WinMain's. If you use GLUT I don't think you need WinMain since it does that for you. I wouldn't use Dev-C++ or GLUT in the first place though. You might have more luck creating a GLUT project (it's in the list) with Code::Blocks and moving the files into that project.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  8. #8
    Registered User
    Join Date
    May 2009
    Location
    Look in your attic, I am there...
    Posts
    92
    The problem is there is no winmain in any of the files in the glut tutorial or in some of the other tutorials i have downloaded, yet there is still the same error

    /mingw/lib/libmingw32.a(main.o):main.c.text+0x104): undefined reference to `WinMain@16'
    Last edited by 127.0.0.1; 08-26-2009 at 12:41 AM. Reason: forgot to add code

  9. #9
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    If you're using nehe's tutorial, then there's a winmain right there. If you've stripped that out to use GLUT instead, then you need to be linking with -lglut32.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mingw and elcipse HELP
    By Rob4226 in forum Windows Programming
    Replies: 1
    Last Post: 03-04-2008, 12:35 AM
  2. MinGW thread-safe runtime libraries
    By Mario F. in forum C++ Programming
    Replies: 3
    Last Post: 08-21-2006, 08:15 AM
  3. compiling mingw to enable timeSetEvent
    By underthesun in forum Windows Programming
    Replies: 2
    Last Post: 02-02-2005, 05:00 PM
  4. SDL and MinGW Studio
    By Vicious in forum Tech Board
    Replies: 0
    Last Post: 07-30-2004, 09:59 PM
  5. Convert Microsoft LIB to MingW compatible lib
    By tigs in forum Windows Programming
    Replies: 0
    Last Post: 07-20-2004, 06:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21