You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When including refl.hpp from more than one source file using gcc 7.5.0, the compiler complains that refl::runtime::detail::next_depth(int) is defined multiple times.
g++ -I./src -MMD -MP --std=c++17 -c src/Effect.cpp -o build/./src/Effect.cpp.o
g++ -I./src -MMD -MP --std=c++17 -c src/main.cpp -o build/./src/main.cpp.o
g++ -I./src -MMD -MP --std=c++17 -c src/Object.cpp -o build/./src/Object.cpp.o
g++ ./build/./src/Effect.cpp.o ./build/./src/main.cpp.o ./build/./src/Object.cpp.o -o build/a.out
./build/./src/main.cpp.o: In function `refl::runtime::detail::next_depth(int)':
main.cpp:(.text+0x0): multiple definition of `refl::runtime::detail::next_depth(int)'
./build/./src/Effect.cpp.o:Effect.cpp:(.text+0x0): first defined here
./build/./src/Object.cpp.o: In function `refl::runtime::detail::next_depth(int)':
Object.cpp:(.text+0x0): multiple definition of `refl::runtime::detail::next_depth(int)'
./build/./src/Effect.cpp.o:Effect.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
Makefile:17: recipe for target 'build/a.out' failed
make: *** [build/a.out] Error 1
Moving the function into an anonymous namespace or declaring it static (both of which force internal linkage) resolves the issue.
The text was updated successfully, but these errors were encountered:
When including
refl.hpp
from more than one source file using gcc 7.5.0, the compiler complains thatrefl::runtime::detail::next_depth(int)
is defined multiple times.Moving the function into an anonymous namespace or declaring it static (both of which force internal linkage) resolves the issue.
The text was updated successfully, but these errors were encountered: