Error using USER_LDFLAGS in executable make file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bajajv
    New Member
    • Jun 2007
    • 152

    #1

    Error using USER_LDFLAGS in executable make file

    hi,

    In my make file, I need to give USER_LDFLAGS.

    I am trying to make an executable, but if I give USER_LDFLAGS as -

    USER_LDFLAGS = -L... (libraries) it gives errors

    and if I give it as -

    USER_LDFLAGS = -shared -L... (libraries)

    it creates a shared library.

    Any idea what could be the reason, I can't give more details about the libraries for obvious reasons.. :(

    Thanks.
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Given that you have not told us what compiler toolset or platform you are using or what errors occured we don't really have all (any of) the information required to give an answer.

    However assuming a fairly normal compiler toolset (gcc) and taking a guess then:

    What are you using -L for? -L is the option to set the library search path, are you sure you didn't mean -l which is the switch to link a library into your executable?

    Comment

    • bajajv
      New Member
      • Jun 2007
      • 152

      #3
      Hi Banfa,

      These are the compiler and platform infos -
      $gcc --version
      gcc (GCC) 4.2.3

      And in makefile, I am giving -
      USER_LDFLAGS = -L$(HOME_DIR)/gmrACE-5.6-32/lib -lACE-5.6
      If I do not give USER_LDFLAGS, it gives many errors for not finding ACE APIs.

      Currently I am getting errors like this -

      obj_rel_Linux_3 2/file_name.o:(.g nu.linkonce.d.r el.ro._ZTV28SOM E_NAME+0x284): undefined reference to `non-virtual thunk to MyClass::update (ObserverSubjec t const*)'

      Proj_Dir/lib/Linux_32/lib_name_hs.so: undefined reference to `Base_Class_of_ MyClass::handle Request(Object_ Store&, short)'

      Proj_Dir/lib/Linux_32/lib_name_hs.so: undefined reference to `non-virtual thunk to Base_Class_of_M yClass::handleR equest(Object_S tore&, short)'

      collect2: ld returned 1 exit status

      I do not get these errors, when I give -shared in USER_LDFLAGS. But it results in creating library. I want to create an executable.

      Hope this info helps.

      Thanks.
      Last edited by Banfa; Jan 17 '13, 10:22 AM. Reason: Removed sensitive information

      Comment

      • bajajv
        New Member
        • Jun 2007
        • 152

        #4
        hi.. can anyone please give some suggestions how to move further, because I am really stuck at this..

        Thanks.

        Comment

        • Banfa
          Recognized Expert Expert
          • Feb 2006
          • 9067

          #5
          Does your make output the actual linker command it uses? it would be useful to see that.

          Are you sure that your linker command includes all the correct object and library files in the correct order?

          Comment

          • bajajv
            New Member
            • Jun 2007
            • 152

            #6
            Hi Banfa,

            Yaa, the problem was in ordering the libraries. It is working now.

            Thanks for the help.

            Comment

            Working...