Skip to content

Commit 9a33d05

Browse files
committed
Linking error fix
Fixes linking error when compiling with Visual Studio and including hnswlib.h in several cpp files. before: 2>Tools.lib(Pch.obj) : error LNK2005: "void __cdecl cpuid(int * const,int,int)" (?cpuid@@YAXQEAHHH@Z) already defined in Pch.obj 2>Tools.lib(NearestNeighbors.obj) : error LNK2005: "void __cdecl cpuid(int * const,int,int)" (?cpuid@@YAXQEAHHH@Z) already defined in Pch.obj 2>C:\Users\Rade\Documents\Data Analysis\Code\GenomicsLab Repo\x64\Release\ExpressionDemo.exe : fatal error LNK1169: one or more multiply defined symbols found 2>Done building project "ExpressionDemo.vcxproj" -- FAILED. after: 2>ExpressionDemo.vcxproj -> C:\Users\Rade\Documents\Data Analysis\Code\GenomicsLab Repo\x64\Release\ExpressionDemo.exe
1 parent 359b2ba commit 9a33d05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hnswlib/hnswlib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#ifdef _MSC_VER
1616
#include <intrin.h>
1717
#include <stdexcept>
18-
void cpuid(int32_t out[4], int32_t eax, int32_t ecx) {
18+
static void cpuid(int32_t out[4], int32_t eax, int32_t ecx) {
1919
__cpuidex(out, eax, ecx);
2020
}
2121
static __int64 xgetbv(unsigned int x) {

0 commit comments

Comments
 (0)