|
From: Chris S. <csh...@qu...> - 2006-03-22 11:15:32
|
Hi,
I'm new MinGW. I'd like to use it to develop a cross-platform C++
application.
I've downloaded and installed MinGW however I'm having a problem getting
g++ to link to libraries.
Here's my application's code:
// Test.cpp.
#include <iostream>
#include <math.h>
#include "gl.h"
#include "glut.h"
using namespace std;
int main()
{
cout << "Hello!" << endl;
return 0;
}
If I try to compile this I get the following error:
c:\programming\c++\g++> g++ Test.cpp -o Test.exe
C:\DOCUME~1\CHRIS~1.LAP\LOCALS~1\Temp/ccymaaaa.o(.text+0x11c):Test.cpp:
undefined reference to `__glutInitWithExit@12'
C:\DOCUME~1\CHRIS~1.LAP\LOCALS~1\Temp/ccymaaaa.o(.text+0x13d):Test.cpp:
undefined reference to `__glutCreateWindowWithExit@8'
C:\DOCUME~1\CHRIS~1.LAP\LOCALS~1\Temp/ccymaaaa.o(.text+0x15d):Test.cpp:
undefined reference to `__glutCreateMenuWithExit@8'
collect2: ld returned 1 exit status
Process g++ exited with code 1
I've also tried:
c:\programming\c++\g++> g++ Test.cpp -o Test.exe -llibglut32
however I then get the following:
c:\programming\c++\g++> g++ Test.cpp -o Test.exe -llibglut32
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe:
cannot find -llibglut32
collect2: ld returned 1 exit status
Process g++ exited with code 1
I've put the glut libraries (libglut32.a, libglut.a) in the folder with
the source code. They are also in C:\MinGW\lib.
What do I need to do to get g++ to link to the glut library?
Cheers,
Chris
|