When you try to link to a static library, you will often get a lot of undefined references
Methodology to resolve the problem
1) Add an Import to the library your linking to
Code:
ImportC "libbar.a" : EndImport
2) Add any Imports to know dependencies
Code:
ImportC "libbar.a" : EndImport
ImportC "-lstdc++" : EndImport ;<------
3) Add Imports directly below the first import statement for a library that's reported an error eg undefined refference to foo ... first appears in libfoo
Code:
ImportC "libbar.a" : EndImport
ImportC "-libfoo" : EndImport ; <------
ImportC "-lstdc++" : EndImport
4) Add the functions to the library your linking to
Code:
ImportC "libbar.a" : EndImport
ImportC "-libfoo" : EndImport
ImportC "-lstdc++" : EndImport
ImportC "libbar.a" ;<------
foo()
bar()
EndImport
Additionally some libraries may have multiple definitions and may still have unresolved symbols
Add these to the top
Code:
ImportC "-Wl,--allow-multiple-definition" : EndImport
ImportC "-Wl,--unresolved-symbols=ignore-in-object-files" : EndImport ;use as a last resort
ImportC "-libfoo" : EndImport
ImportC "-lstdc++" : EndImport
ImportC "libbar.a"
foo()
bar()
EndImport