hello:
i want to use a static library in my program,but have no idea how to use it.
i use wxDevc++
int main(void)
{
// i want to use the function in the static library,
how to set it up to work, i try so many times and keep
failing
}
source code in my static library. i compiled it, and get "MyLib.a"
StaticLib.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#ifndef STATICLIBFUNCS_H
#define STATICLIBFUNCS_H
namespace StaticLibFuncs
{
class MyStaticFuncs
{
public:
staticdouble FuncA(double a, double b);
staticdouble FuncB(double a, double b);
};
}
#endif
StaticLib.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include "StaticLib.h"
namespace StaticLibFuncs
{
double MyStaticFuncs::FuncA(double a, double b)
{
return a + b; // Replace with your own code
}
double MyStaticFuncs::FuncB(double a, double b)
{
return a - b; // Replace with your own code
}
}