Compiling .o and .a files for C::B

Started by
20 comments, last by NightCreature83 12 years, 7 months ago
Hi, I've got some source for a book I'm reading and its all in cpp files at the minute. I was wondering how do I make it .o and .a files with mingw, so I can create a library?
Advertisement
.o files are object files which are the result of compilation. Back in the good ol' day, compilation and linking where separate processes, but nowadays they are combined into just compilation. There should be a switch in the compiler that makes the compiler stop before linking so you'll have .o files.

I'm not sure how to write .a files.

Yo dawg, don't even trip.

.a files are just static libraries. Create a new project, designate it as a static library, add your .cpp files, and hit Build. voila, a bin directory full of .o files and one .a file. You will have no practical use for the .o files (as the previous poster said, they're just an intermediate step between compilation and linking) but the .a static lib can be linked to by other projects.

.a files are just static libraries. Create a new project, designate it as a static library, add your .cpp files, and hit Build. voila, a bin directory full of .o files and one .a file. You will have no practical use for the .o files (as the previous poster said, they're just an intermediate step between compilation and linking) but the .a static lib can be linked to by other projects.


"You must select a host application to run a library.

Basically its the GLTools source files from OpenGL SuperBible 5th Edition. This is a NIGHTMARE.
You can't "run" a library, you can only run an executable that links to the library.

You can't "run" a library, you can only run an executable that links to the library.


I know, thats why i dont ****ing get it. UGH.
So just build an application that links to the library.
Right I think these needs to be put in the most simplest format you can.
?
Iv got source, its cpp, apparently it needs to all be a .lib or .a file. All the files I need are in a single directory. How do I compile that directory using Codeblocks into a library? Im sorry for sounding so stupid but seriously, iv been at this for days now.
A .cpp doesn't necessarily need to be made into a library to use it. If you have all the .cpp files for a particular "library", rather than going through the intermediate step of building a library, you can just bring the .cpp files directly into your project instead. Just go to Project->Add files then select all of the .cpp files you want to add.
Tryed it, still getting stupid undefined reference to errors. This book has become an absolute nightmare. OpenGL superbible 5th edition is an absolute piss take to set up. Is there ANYWHERE on the internet that has ALL the binaries and guide on where to put them and what the **** to do with them?

This topic is closed to new replies.

Advertisement