1

I'm a complete newbie when it comes to using libraries, so any assistance would be very welcome.

I use Code::Blocks and am trying to link my code with libraries. I have two libraries to be linked : "libone.a" and "libtwo.so".

So, according to this , albeit older, tutorial, I rightclicked the project in Code::Blocks, went to Project build options -> Linker settings, and added both of the libraries. I also went to Search Directories -> Compiler, and Search Directories -> linker and added the path of the libraries.

Now, one of these libraries contains a file called "dis.hxx". However, when i put " #include < dis.hxx > " into my program, it states fatal error: dis.hxx: No such file or directory. Note that this header file is inside the .a file, not unpacked.

Am I understanding the concept of libraries wrong? How can I make this work?

user129186
  • 1,156
  • 2
  • 14
  • 30
  • "Note that this header file is inside the .a file, not unpacked." Ehm what? You shouldn´t use programming libs as file archives like zip-file. – deviantfan May 05 '14 at 20:16
  • It is to my understanding that this .a file contains several header and .cpp files. I even managed to extract them using a tool. However the whole point of a library is the unnecessarity to add every single file, right? – user129186 May 05 '14 at 20:22
  • Your understanding is wrong. If you want something like that, possibilities include zip, rar, tar, 7z... . A library in this context is a precompiled thing. Maybe the source is part of the download etc., but the lib itself is no source code, but compiled like a full program (it can´t be executed alone like a program, that´s the main difference). They contain executable function which can be used in your own main program. Difference a/so: Static libs (a) ill be includued to your program file while compiling/linking. Shared libs (so = shared objects) remain in a separate file. – deviantfan May 05 '14 at 20:34
  • Okay, I understand, but now I am truly confused. Forgive my ignorance, but how do I make use of the contents of the library if it is precompiled? Specifically this executable function you mention? How would I go around acessing it? – user129186 May 05 '14 at 20:46

0 Answers0