Linking against GSL on OS X 10.5 Leopard
imported Code · ic.ac.uk · Tech
Since I’m taking the Computational Physics module in my third year at IC, we’re using some libraries like GSL to provide “better-than-default” random number generators and such like. It turns out that those of us using a Mac don’t get GSL installed by default with Xcode, or under OS X - and unlike Windows and Linux - there’s no instructions on the course site. Here’s a really quick way to ensure that you can link against it:
- Install MacPorts from MacPorts.org.
$ sudo /opt/local/bin/port install gsl
- In the directory that you’re writing your code from, perform the following:
$ g++ -I/opt/local/include -L/opt/local/lib -lgsl -o binary_name source_file.cpp
Which should let you link against GSL just fine :-)