niuus / WiiSXRX

Fork of wiisxr (a port of PCSX-R), a PSX emulator for the Gamecube / Wii / Wii U
GNU General Public License v3.0
151 stars 11 forks source link

Fix 'multiple definition of ...' linker errors. #10

Open retro100 opened 3 years ago

retro100 commented 3 years ago

With devkitPPC release 38 - 10.2.0 (versions for powerpc-eabi-gcc and powerpc-eabi-g++) i can't compile (link) the current master version of WiiSXRX. The linker produce many 'multiple definition of ...' messages and failed to link successfully.

The main reason are the global (non static) variables in header files and the extern inline functions in the header files. Including this header files in different translation units produces the multiple definitions. To fix it I make the definition of the non-static global variables in the correct c-files and only give the declarations to the header file (with extern). The inline functions are changed from extern inline to static inline to avoid the multiple definitions.