I have several .o files and want to bundle them in a .dylib, how can I do that it Mac OS X using gcc? Thank you very much.
Asked
Active
Viewed 2.0k times
1 Answers
73
Use g++ -dynamiclib -undefined suppress -flat_namespace *.o -o something.dylib

Tianyi Cui
- 3,933
- 3
- 21
- 18
-
6Note to anyone reading this in later years: The -flat_namespace option is no longer necessary. It was a compatibility hack introduced around OS 10.4 to make libraries built with 10.4+ tools to still work with pre-10.4 systems. On later systems, it can cause linking problems and should not be used. – Ross Smith Jul 06 '16 at 21:45