mingw-cross-env-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mingw-cross-env-list] Undefined reference to freeglut library functions


From: Son Hua
Subject: [Mingw-cross-env-list] Undefined reference to freeglut library functions
Date: Thu, 16 Dec 2010 14:41:47 +0900
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14pre) Gecko/20101201 Lightning/1.0b2 Shredder/3.1.8pre

Hi all,

I used mingw-cross-env on Ubuntu 10.10 to cross compile a simple OpenGL program (Lesson 03 of NeHe, http://nehe.gamedev.net/data/lessons/linux/lesson03.tar.gz).

MinGW compiled the program fine, but failed to link to functions in GLUT library, which is actually freeglut installed by mingw-cross-env using "make freeglut". I included my output here. To reproduce the error, please follow these steps.

1. Follow the tutorial on mingw-cross-env website to install mingw cross compile environment. I tried with both 2.17 and the development version. Install freeglut by "make freeglut". 2. Download a simple OpenGL program (http://nehe.gamedev.net/data/lessons/linux/lesson03.tar.gz) to test for cross compilation. Here uses lesson03 of NeHe.
3. Compile
i686-pc-mingw32-gcc -c lesson3.c
4. Link
i686-pc-mingw32-gcc -o lesson3.exe lesson3.o -lopengl32 -lglu32 -lglut

Step 1 - 3 works fine. Output of step 4:
lesson3.o:lesson3.c:(.text+0x1c): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x3e): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x60): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x3b9): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x3e8): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x432): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x44b): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x464): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x48a): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x494): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x4a3): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x4b4): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x4c5): undefined reference to address@hidden' lesson3.o:lesson3.c:(.text+0x4e3): undefined reference to address@hidden'
collect2: ld returned 1 exit status

As far as I know, the opengl32, glu32, glut library is found by examining relative path from i686-pc-mingw32-gcc to find the "lib" folder, so the library path should not be a problem here.

I also notice similar undefined reference with functions in FreeImage library. Am I doing anything wrong here? Note that the program compiles well using gcc on Ubuntu. But it failed when using i686-pc-mingw32-gcc.

Thanks for your help.

Best regards,
Son.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]