Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8769159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:15:46+00:00 2026-06-13T17:15:46+00:00

I tried to compile my c++/opengl-project with the g++ command. (I need this since

  • 0

I tried to compile my c++/opengl-project with the g++ command.
(I need this since I want to recompile it on every target system with a second self-written program.)

But when I execute:

g++ -Iinclude -Isrc $(pkg-config --cflags freetype2) -L/usr/X11R6/lib -L/usr/lib $(pkg-config --libs glew) -lglut $(pkg-config --libs glu) $(pkg-config --libs freetype2) main.cpp  (some more source files) src/Vec4.cpp

I get lots of ‘undefined references’ for gl/glu/glut/glew-functions, so I guess something fails with the libs:

/tmp/ccUm2dEl.o: In function `Box::render()':
Box.cpp:(.text+0x6e8): undefined reference to `glEnable'
Box.cpp:(.text+0x72c): undefined reference to `glBindTexture'
Box.cpp:(.text+0x736): undefined reference to `glBegin'
...
TextureManager.cpp:(.text+0x23b): undefined reference to `glTexParameteri'
TextureManager.cpp:(.text+0x295): undefined reference to `glTexImage2D'
collect2: ld gab 1 als Ende-Status zurück

I did some research, but according to what I found out the above command should be correct.
I checked the pkg-config-calls as well and they seem to work.
Before I tried the g++ command I used the Codeblocks IDE to compile it and it worked. Here are my settings:

In Compiler settings|Other options:

`pkg-config --cflags freetype2`

In Linker settings|Link libraries:

glut

In Linker settings|Other linker options:

`pkg-config --libs glu`
`pkg-config --libs glew`
`pkg-config --libs freetype2`

In Search directories|Compiler:

include
src

My system (Ubuntu Precise):

$ uname -a
Linux andromeda 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ g++ -dumpversion
4.6

glxinfo
GLX version: 1.4
OpenGL version string: 4.2.0 NVIDIA 304.43

Codeblocks-version: 10.04

Thanks in advice

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:15:47+00:00Added an answer on June 13, 2026 at 5:15 pm

    The problem is most likely that you link in the wrong order. The GNU linker wants its libraries in kind of reverse order, so if you place the linker libraries last on the command line it should go better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to compile this example: #include <stdio.h> #include <stdlib.h> #include <stddef.h> main(){ size_t
I tried to compile Ercia Sadun's sample code here , but this error came
I tried to compile Qt+Webkit statically with MS VS 2008 and this worked. C:\Qt\4.6.2>configure
This is the full error report that is generated when tried to compile my
I am learning OpenGL these days, and I tried to compile the example code
I tried to compile Speex library on iOS following this tutorial and succeeded to
My project compiles, link and run in xp32 then I tried to cross compile
I tried to compile wxWidgets-2.9.2 with opengl support by calling configure --with-opengl But it
When I tried to compile (use javac)some java sources files include a comment line
I have tried to compile some C++ WIN32 code with GCC through DevC++ (MinGW

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.