에러내용 :
[build] In file included from /home/nukim/code/fruc/lib/include/search_unit.h:4,
[build] from /home/nukim/code/fruc/lib/src/search_unit.cpp:1:
[build] /home/nukim/code/fruc/lib/include/blockmath.h:18:17: error: ‘void InitFunctions()’ declared ‘static’ but never defined [-Werror=unused-function]
[build] 18 | static void InitFunctions();
[build] | ^~~~~~~~~~~~~
헤더파일 :
#pragma once
#include "typedef.h"
#define DIST_FUNC_PARAM const uint8_t *src0, const uint8_t *src1, int pitch1
#define COPY_FUNC_PARAM uint8_t *dst, const uint8_t *src, int src_pitch
#define AVG_FUNC_PARAM const uint8_t *src
typedef int (*DistFunc) (DIST_FUNC_PARAM);
typedef void (*CopyFunc) (COPY_FUNC_PARAM);
typedef int (*AvgFunc) (AVG_FUNC_PARAM);
// function table
extern CopyFunc* g_fpCopy[5];
extern AvgFunc* g_fpAvg[5];
extern DistFunc* g_fpSAD[5];
extern DistFunc* g_fpSATD[5];
static void InitFunctions();
inline CopyFunc GetCopyFunction(int log2BlkSize){ return *g_fpCopy[log2BlkSize]; }
inline DistFunc GetSADFunction(int log2BlkSize) { return *g_fpSAD[log2BlkSize]; }
inline DistFunc GetSATDFunction(int log2BlkSize) { return *g_fpSATD[log2BlkSize]; }
inline AvgFunc GetAvgFunction(int log2BlkSize) { return *g_fpAvg[log2BlkSize]; }
int NullDistFunc(DIST_FUNC_PARAM) { return 0; }
void NullCopyFunc(COPY_FUNC_PARAM) {}
int NullAvgFunc(AVG_FUNC_PARAM) { return 0; }
소스파일:
#include "blockmath.h"
#include <emmintrin.h>
#include <pmmintrin.h>
#include <tmmintrin.h>
#include <immintrin.h>
constexpr int CPU_SCALAR = 0;
constexpr int CPU_MMX = 1;
constexpr int CPU_SSE4 = 2;
constexpr int CPU_AVX2 = 3;
constexpr int CPU_AVX512 = 4;
void InitFunctions()
{
}
CMakeList.txt:
file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
)
add_library(mci STATIC ${SRC_FILES})
target_include_directories(mci PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_options(mci PRIVATE -Wall -Werror -mavx -mavx2)
아니 왜 다른건 다 잘되는데 여기서만 문제가 발생하는건지 도통 이해를 못하겠네
개발 환경은 linux , vscode 임
static 에 대한 이해도가 부족한 겄이었음 문제해결 ㅇㅇ
이유 알려줘 ㅇㅅㅇ..
일반 함수는 extern 이 자동으로 붙고, 다른 파일에서 쓰더라도 원본을 참조하는데 static 함수는 다른 파일에서 쓰면 그 함수 자체를 복사하게 되는데, h파일만 inlclude 한 경우에는 구현된 내용물은 복사가 안되므로 구현이 안되있다고 컴파일 에러가 뜨는것이었음 ㅇㅅㅇ
오오 첨 알았네 ㄳ