specify linker switch in code

This is a discussion on specify linker switch in code within the C Programming forums, part of the General Programming Boards category; Is there a way to include (eg) "-lm" in source code so that when it's compiled, this switch will be ...

  1. #1
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300

    specify linker switch in code

    Is there a way to include (eg) "-lm" in source code so that when it's compiled, this switch will be used without having to put it on the command-line?
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #2
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Not AFAIK, but why not use a makefile for that stuff?

  3. #3
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,049
    Looks like you need a makefile

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Actually it's okay -- I can't use a makefile, it was for a prime number thing at "sphere" and I thought it would be a little silly if you had to write your own sqrt(). But it seems like using #include <math.h> was enough, perhaps they add the switch.

    And after spending all afternoon there, I decided to give up on "sphere"...
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. Finding object code
    By kidburla in forum C Programming
    Replies: 3
    Last Post: 11-29-2005, 01:09 PM
  3. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 02:37 PM
  4. Seems like correct code, but results are not right...
    By OmniMirror in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 01:33 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21