Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
804 views
in Technique[技术] by (71.8m points)

c - Adding Linker Flags in Xcode

(I'm not sure if "flag" is the word I'm looking for, but I'll explain it.)

I am trying to compile a program that uses the GMP big number library. But to be able to compile with GMP, I have to add -lgmp to the end of the command. For example, if I want to compile "program.c", I have to type gcc program.c -lgmp. This is easy from the command line, but I don't see how to do it in Xcode. How can I add the lgmp flag while using Xcode?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Right-click the target in the Xcode Groups and Files list and select Get Info from the contextual menu. In the Build tab, type linker into the search field and then locate the Other Linker Flags item.

Double-click the Other Linker Flags item and add -lgmp.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...