I have a CL Math library I am putting together. For this, I would like to only expose certain header files (like CL_Vector.h). All header files used for processing are hidden inside the .lib file.
However, when I try and use my library in another C++ project, I get linker errors. These linker errors are usually related to code that is "hidden" in the library. So for instance a CPP file:
#include "CL_Calculation_Unit.h"
#include "CL_MathBootstrap.h"
#include "CL_Math_Buffer_Management.h"
#include <stdio.h>
namespace CLMath_Internal
{
void CalculateVector4(CLMath::CLM_VECTOR4* vec1, CLMath::CLM_VECTOR4* vec2, CLMath::CLM_VECTOR4* output, cl_kernel kernel, size_t workSize)
{
CLMath_Internal::CLMathDriver driver = CLMath_Internal::getDriver();
The C++ project that uses this lib throws me:
error LNK2001: unresolved external symbol "struct CLMath_Internal::CLMathDriver const & __cdecl CLMath_Internal::getDriver(void)" (?getDriver@CLMath_Internal@@YAABUCLMathDriver@1@XZ)
The header files that I provide with my .lib are like this:
CL_Matrix.h
#ifndef __CL__MATH__MATRIX__
#define __CL__MATH__MATRIX__
#include "CL_Math_Vector.h"
namespace CLMath
{
.....
and CL_Vector.h
#ifndef __CL_MATH__VECTOR__
#define __CL_MATH__VECTOR__
namespace CLMath
{
....
and CL_Math.h
#ifndef __CL__MATH__
#define __CL__MATH__
#include "CL_Math_Matrix.h"
#include "CL_Math_Vector.h"
namespace CLMath
{
As you can see I am not including any of the "internal" header files. Instead I moved them all into the cpp files which need to use them.
All internal headers are included in the CPP files as to "hide" them and void packaging them with the lib.
I am sorry if it's not very clear. Please let me know if I can clear up my question somehow!
Edit: Also note that I am using Visual Studio with the 110 compiler. Maybe it's something wrong with my build settings?