User forums > Using Code::Blocks

How develop libraries & classes in any directory and include it in main file?

<< < (2/2)

R1S8K:
I tried that solution but I think I don't know what I'm doing.

I tried to add the main path for the project, but didn't work.

I did 2 things according to the link provided.

1. Add the main class libraries in the settings menu/compiler/Search directories/Compiler and Linker tabs I added the main path
2. Project/Build options/Search directories/Compiler and Linker tabs I added the main path

F:\computer_programming_dev\Programming_exercises\C++\classes\

This path contains:

1. 2 classes example folders
2. 1 main program folder

An this path contains the attached picture.


But the same problem, what I'm missing !



===================================================================================

BUT ! I actually developed those classes as simple new classes from File/New/Class

I thought that's it! That what it takes to develop a class library that can be used as #include "lib_ex.h" in projects. But when I search for them I actually don't find its library specific files like .a ... etc. They are just .cpp and .h files ! Does that consider these two files as library ?

I think I have to choose a complete new project library from the start as: static, dynamic or shared library. I think just developing a class that is .cpp or .h is what it takes for what I want!


So I want to develop a class library that can be included in a project, what should I choose of the three, static, dynamic or shared library?

BlueHazzard:
Without:  http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
we can not help and will ignore all future post of you...

R1S8K:
OK, I was able to solve the previous problem by developing a shared library in the main projects folder.

The main projects folder contains:
1. Application project folder.
2. Shared library example folder.

So I could include the new shared library, but when I tried to run the function from the shared library into the main project source file, I got an error saying

--- Quote ---the code execution cannot proceed because .dll was not found
--- End quote ---

So I had to copy the shared library .dll file into the bin folder of the main project folder. And problem is solved.

My new question is:
How to include the .dll files in the main project bin folder automatically?

Now, if I've done anything new in the library, then I have to compile it and then copy the .dll file again into the bin of the main application folder.

R1S8K:
Update2:
OK, I solved the problem of linking .dll files.


My question now is relatively general to how things work with code blocks. Now, what should I add to the main project in the build option every time I want to include a new library? Do I have to do the same procedure of adding the .a and .dll paths ?

Navigation

[0] Message Index

[*] Previous page

Go to full version