Jump to content
  • Advertisement
Sign in to follow this  

undefined reference

This topic is 1891 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to run a program : http://ogldev.atspace.co.uk/www/tutorial16/tutorial16.html

However, I get undefined reference to some function mentioned below, which is weird, because all those function and their headers are included in the tutorial source.

g++ tutorial16.cpp -lGLEW -lGL -lglut -I/usr/include/ImageMagick/


/tmp/ccsp9wYo.o: In function `RenderSceneCB()':
tutorial16.cpp:(.text+0x14): undefined reference to `Camera::OnRender()'
tutorial16.cpp:(.text+0x128): undefined reference to `Pipeline::GetTrans()'
tutorial16.cpp:(.text+0x215): undefined reference to `Texture::Bind(unsigned int)'
/tmp/ccsp9wYo.o: In function `SpecialKeyboardCB(int, int, int)':
tutorial16.cpp:(.text+0x27e): undefined reference to `Camera::OnKeyboard(int)'
/tmp/ccsp9wYo.o: In function `PassiveMouseCB(int, int)':
tutorial16.cpp:(.text+0x2bd): undefined reference to `Camera::OnMouse(int, int)'
/tmp/ccsp9wYo.o: In function `main':
tutorial16.cpp:(.text+0xa9b): undefined reference to `Camera::Camera(int, int)'
tutorial16.cpp:(.text+0xba3): undefined reference to `Texture::Texture(unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
tutorial16.cpp:(.text+0xbce): undefined reference to `Texture::Load()'
collect2: ld returned 1 exit status

This is very weird, Can anyone running Linux do me a favor to try to run this program, I want to see where the problem comes from.

(Don't forget to install libMagick with apt-get install libmagick++-dev)

Edited by saman_artorious

Share this post

Link to post
Share on other sites

There are more than the one CPP file in the project: camera.cpp, pipeline.,cpp, texture.cpp, ... of which you have none compiled / linked. Use the included makefile instead. 

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!