Hello.
From File>New>Project>Static lib> CodeBlocks makes automatically the liba.a library at C:...Desktop\New Folder\a\bin\Debug dir, that contains only ...
1 2 3 4
int SampleAddInt(int i1, int i2)
{
return i1 + i2;
}
by default.
Then from File>New>Project>Console application i made the main.cpp in c++ language with code...
In main.cpp, you need to #include the .h file that contains the declaration of SampleAddInt.
If you don't have one, you can make one yourself:
1 2 3 4 5 6 7 8 9
// Apparently, you named your library 'a'
// So name this file 'a.h'
#ifndef A_H_INCLUDED // Or pick a different identifier; doesn't really matter
#define A_H_INCLUDED
int SampleAddInt(int i1, int i2);
#endif
and then #include "a.h" (but make sure that it's in the same directory as main.cpp).
Or, if you're too lazy to do any of that, just put int SampleAddInt(int i1, int i2);
on line 4 of your main.cpp.