This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-10-13 10:25:31

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

C++ with OpenGL: Linkers hate me

So I've had many issues with C++ over this year, and I'm in another one.

I am trying to create my own game engine/library. I have everything set up, a header file, a batch file to move the lib's files over to my testing project, and more. I can get the library to compile properly, but it's when I compile the test project when I get the issue.

Code:

   [Linker error] libPendulum.a(pendulum.o):pendulum.cpp:(.text+0x26c): undefined reference to `__imp__glewInit@0'

Earlier, I was having more linker errors which were solved by adding -lglew32 to the parameters list (I'm using Orwell Dev-C++, an updated version of Dev-C++) All of the libraries necessary are in both directories (PendulumLibrary is the library directory and LibTestingis the testing directory) and are linked. Does anyone know what's wrong? The function not working is "glewInit();".


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#2 2012-10-13 10:31:20

pwiter
Scratcher
Registered: 2010-06-02
Posts: 100+

Re: C++ with OpenGL: Linkers hate me

I don't use Dev C++, I just use gedit and compile with the command line.

Try compiling with the command line.


http://i.imgur.com/YBeXc.png

Offline

 

#3 2012-10-13 10:44:23

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: C++ with OpenGL: Linkers hate me

pwiter wrote:

I don't use Dev C++, I just use gedit and compile with the command line.

Try compiling with the command line.

Linux? I've always thought compiling from terminal/command line would be extremely ugly, IMO. Can you give pointers on compiling on Linux for Windows platforms? I still don't think it would make a difference if it was compiled manually vs from command line. Also, it's not a compile error, it's a linker error.

Last edited by 16Skittles (2012-10-13 10:44:58)


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#4 2012-10-13 11:56:23

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: C++ with OpenGL: Linkers hate me

16Skittles wrote:

pwiter wrote:

I don't use Dev C++, I just use gedit and compile with the command line.

Try compiling with the command line.

Linux? I've always thought compiling from terminal/command line would be extremely ugly, IMO. Can you give pointers on compiling on Linux for Windows platforms? I still don't think it would make a difference if it was compiled manually vs from command line. Also, it's not a compile error, it's a linker error.

I've always found it annoying when compiling C programs that it would always output a .exe and I wasn't ever able to run it because I didn't know how on Linux (it's different now though). So I'm sure the commands you use to compile on Windows would be generally the same.

http://stackoverflow.com/questions/1824 … to-windows might be useful.

As for the error, it looks like you didn't define the reference to `__imp__glewInit@0'. I would think that's a missing variable or something. Though I know almost nothing about C++ and especially OpenGL. I read another forum related to this and they suggested just dropping the glew32.dll into the project or something. So I don't know.

Last edited by Magnie (2012-10-13 12:01:55)

Offline

 

#5 2012-10-13 12:14:04

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: C++ with OpenGL: Linkers hate me

Nuuuuuuu!!1!1!!11!!!one!!
Stackoverflow it down. D:


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#6 2012-10-13 12:28:25

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: C++ with OpenGL: Linkers hate me

Magnie wrote:

16Skittles wrote:

pwiter wrote:

I don't use Dev C++, I just use gedit and compile with the command line.

Try compiling with the command line.

Linux? I've always thought compiling from terminal/command line would be extremely ugly, IMO. Can you give pointers on compiling on Linux for Windows platforms? I still don't think it would make a difference if it was compiled manually vs from command line. Also, it's not a compile error, it's a linker error.

I've always found it annoying when compiling C programs that it would always output a .exe and I wasn't ever able to run it because I didn't know how on Linux (it's different now though). So I'm sure the commands you use to compile on Windows would be generally the same.

http://stackoverflow.com/questions/1824 … to-windows might be useful.

As for the error, it looks like you didn't define the reference to `__imp__glewInit@0'. I would think that's a missing variable or something. Though I know almost nothing about C++ and especially OpenGL. I read another forum related to this and they suggested just dropping the glew32.dll into the project or something. So I don't know.

Thanks for the SO link, will visit it when it's back up.  tongue
As for dropping glew32.dll into the project, how  would I go about that? It is in the project directory at the moment, but the project links to glew32.lib.


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#7 2012-10-13 12:47:20

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: C++ with OpenGL: Linkers hate me

Stackoverflow is up but read-only now.


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#8 2012-10-13 13:30:46

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: C++ with OpenGL: Linkers hate me

16Skittles wrote:

Magnie wrote:

16Skittles wrote:


Linux? I've always thought compiling from terminal/command line would be extremely ugly, IMO. Can you give pointers on compiling on Linux for Windows platforms? I still don't think it would make a difference if it was compiled manually vs from command line. Also, it's not a compile error, it's a linker error.

I've always found it annoying when compiling C programs that it would always output a .exe and I wasn't ever able to run it because I didn't know how on Linux (it's different now though). So I'm sure the commands you use to compile on Windows would be generally the same.

http://stackoverflow.com/questions/1824 … to-windows might be useful.

As for the error, it looks like you didn't define the reference to `__imp__glewInit@0'. I would think that's a missing variable or something. Though I know almost nothing about C++ and especially OpenGL. I read another forum related to this and they suggested just dropping the glew32.dll into the project or something. So I don't know.

Thanks for the SO link, will visit it when it's back up.  tongue
As for dropping glew32.dll into the project, how  would I go about that? It is in the project directory at the moment, but the project links to glew32.lib.

No idea. If you look at the last two posts here you might be able to understand.  tongue

Offline

 

Board footer