User forums > Using Code::Blocks
Shared lib question
CarstenT:
Hi all,
I've compiled the default 'shared library' projekt and a console test project where I link up with the shared library. The test-project compiles ok and no linker errors. From here I feel extremely stupid that I cannot access the functions in the library.
The shared library has something like
main()
{
int add( int a , int b ){ return a + b ;}
.. more functs
}
it beats me why I get an error when I use add(..) in the Test-consol main()
Should I add some #include directive? Use a prefix. Create an object of sort and access add() as a member?
oBFusCATed:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Inspect the other FAQ entries, they might be helpful, too.
Brute:
--- Quote from: CarstenT on January 22, 2015, 03:16:50 pm ---main()
{
int add( int a , int b ){ return a + b ;}
.. more functs
}
--- End quote ---
I would recommend you to visit http://www.cplusplus.com/forum/beginner/
stahta01:
--- Quote from: Brute on January 22, 2015, 11:53:41 pm ---
--- Quote from: CarstenT on January 22, 2015, 03:16:50 pm ---main()
{
int add( int a , int b ){ return a + b ;}
.. more functs
}
--- End quote ---
I would recommend you to visit http://www.cplusplus.com/forum/beginner/
--- End quote ---
Please read the prior post on the full build log before going to another C++ site to ask for help.
You should also post the error message when you ask for help.
Tim S.
CarstenT:
hi folks,
thanks for the response.
I've added an
#include <main>
in the consol test project. That made the function add(..) visible. I havn't tested weather I can change the name 'main()' as I find it inappropriate as a name of a library.
As for going through the compile error of the consol test project compilation .. it seems as an error that I've met many times before and would contain something like 'function add(..)' not available in this scoop (and not how to mend the problem).
Anyway, since I've used only very simple default projects, I thought that you could be interested in the general problem. I mean, wouldn't add(..) be available in some standard manner if I use the standard project and standard linking?
I'm pretty sure that I started a shared library project .. for some reason I had to change the compile target later on from dynamic library to shared library. This could make something off-standard.
thanks for the attention
Navigation
[0] Message Index
[#] Next page
Go to full version