I have another problem with compiling. I have to include file and I don't know how to write it in g++ command.
I made a wrong command: g++ -Wall -I /usr/local/include/ -I include/ /Users/rio/SgDev/a.cpp -pthread regards, On Aug 6, 2014, at 6:15 PM, Emyr James <[email protected]> wrote: > there should be a program called gsl-config available after you install it > which helps you get the compiler options right. > > To compile it on 1 line on linux I did... > > gcc `gsl-config --cflags` -o example example.c `gsl-config --libs` > > (note the use of backticks) > > then > > ./example > > to run it > > > > On 6 August 2014 14:39, Emyr James <[email protected]> wrote: > Also, make files are a good thing to use. > > > > On 6 August 2014 14:20, Emyr James <[email protected]> wrote: > Yes...you are not linking the gsl libraries... > > I think you need to learn a bit more about C and gcc before looking at gsl... > > > On 6 August 2014 14:07, rio <[email protected]> wrote: > > rio:testing rio$ gcc example.o -o example > Undefined symbols for architecture x86_64: > "_gsl_sf_bessel_J0", referenced from: > _main in example.o > ld: symbol(s) not found for architecture x86_64 > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > > On Aug 6, 2014, at 5:30 PM, Emyr James <[email protected]> wrote: > >> ...object *file*.... >> >> >> >> On 6 August 2014 13:59, Emyr James <[email protected]> wrote: >> You're trying to execute the object fime instead of the actual executable. >> >> Do... >> >> ./example >> >> ... not ... >> >> ./example.o >> >> >> >> On 6 August 2014 13:53, rio <[email protected]> wrote: >> Hi :-) >> >> I installed gel by brew in mac os 10.8.6. >> I want to compile this code : http://codepad.org/Z8uC8KPA >> >> This error happened. >> >> rio:testing rio$ gcc -Wall -I /usr/local/include/ -c example.c >> rio:testing rio$ gcc -L/usr/local/lib example.o -lgsl -lgslcblas -lm >> rio:testing rio$ ./example.o >> -bash: ./example.o: Permission denied >> rio:testing rio$ chmod +x example.o >> rio:testing rio$ ./example.o >> -bash: ./example.o: Malformed Mach-o file >> >> Best regards, >> Rio >> >> >> > > > >
