# OpenGL Problems with library linkage?

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

## Recommended Posts

I decided to start trying to learn OpenGL a couplt of days ago, and followed the NeHe tutorial, but at lesson 1 I've had problems compiling, my first problem was with GLuax, which after searching here I discovered how to add new libraries to Dev-C++, but now whenever I try compiling, I get a bunch of linker errors, a quick example: [Linker error] undefined reference to glViewport@16' [Linker error] undefined reference to glMatrixMode@4' [Linker error] undefined reference to `glLoadIdentity@0' My initial thought was Dev-C++ was the problem, so I tried compiling with Code::Blocks, and the exact same errors occured, I've searched (not for long I admit as its begining to annoy me) and had no luck as to what the problem is. I'm not a total newby at programming, and I'm guessing I'm missing something from my makefile, but I'm using the auto generated ones from Dev-C++ and Code::Blocks. Also, a quick random question, my normal language is C, and not CPP, is it possible to use OpenGL in C, or only in CPP? (I've not found any guides to C so I highly doubt it). Thanks in advance for any replies. -Aura

##### Share on other sites
It sounds like the linker isn't finding the OpenGL shared libraries. It's been a while since I've used Dev-C++, but you'll want to double check that Dev-C++ is telling the linker to link properly.

I believe there is a Project Options menu or something, where you can "Add Libraries". Try adding something like -lopengl32 to it.

Also, I know nothing about GLaux except that I believe it is deprecated and no longer used anymore. You might want to double check but I don't believe you should be using it.

OpenGL should work fine with C. I believe it was even designed with C in mind.

##### Share on other sites
Thanks for that, its solved, apparently glu32 and opengl32 were not linking, I guess I'll use my own makefiles, which is what I'm used to, I just hoped Dev-C++ would make life easier for me. Thanks a lot :)

-Aura

##### Share on other sites
DevC++ has a package update that downloads all kinds of libraries and it has one to setup openGL files. Go to the package/updates, you can get openGL, and then you can actually build a pre-setup openGL application.

They also have a glaux library as well.

##### Share on other sites
btw, C and C++ are interchangeable in projects. I would assume DevC++ supports changes since its a decent compiler.

##### Share on other sites
Quote:
 Original post by dpadam450btw, C and C++ are interchangeable in projects. I would assume DevC++ supports changes since its a decent compiler.

Standard DevC++ bashing / nitpick post: DevC++ is not a compiler, it's an IDE. It's also old (no updates since 2005) and horribly buggy.

Far better to use Code::Blocks (new release version just out), or MS Visual C++.

##### Share on other sites
Quote:
 Original post by sprite_houndStandard DevC++ bashing / nitpick post: DevC++ is not a compiler, it's an IDE. It's also old (no updates since 2005) and horribly buggy.Far better to use Code::Blocks (new release version just out), or MS Visual C++.

I agree Dev-C++ is buggy, and I know its very old, but at the moment it compiles, which is more than I can say for Code::Blocks, whenever I try and compile with it I get errors, and I'm finding the whole layout more difficult to get to grips with, Dev-C++ is (in my opinion anyhow) better laid out.

I normally use Notepad++ for editing, and Cygwin for compiling, and I'll probably end up switching back to this method as its what I know.

-Aura

##### Share on other sites
Quote:
 Original post by sprite_houndFar better to use Code::Blocks (new release version just out)...

Oh, excellent! I've been too lazy to get the nightly builds from SVN, so it's great to hear that they've got a new version out.

##### Share on other sites
Yeah, I've come to realize that I prefer having no IDE, just a good text editor and command-line compiler (invoked through standard makefiles).

I use VIM for my text editor, it takes a little bit to learn, but for C/C++ programming I find that once familiar with it, programming becomes much more efficient.

##### Share on other sites
Agreed, it also allows portability, as you can save everything you need to a flash drive and compile on other computers (which is what I did in the past), it also means you don't have to get bogged down trawling through options just to add a new library or to update your current libraries, you place them where you want, and add the location to your makefile. First time I saw a makefile I was totally confused, its only since I started developing on PCs and not consoles that I've realised how dependent on them I've become (in a good way of course).

-Aura

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633303
• Total Posts
3011277
• ### Who's Online (See full list)

There are no registered users currently online

×