Re: How to make a program look for dylibs other than /usr/local/lib?
Re: How to make a program look for dylibs other than /usr/local/lib?
- Subject: Re: How to make a program look for dylibs other than /usr/local/lib?
- From: "parag vibhute" <email@hidden>
- Date: Sat, 8 Dec 2007 22:36:18 +0530
In first scenario, following is code:
CManager::iterator itr;
//some code to assign value to itr
CTime *tm; // CTime is a class defined by dynamic library creator
tm=(CTime *)handleCTimeobjcreate( );//create CTime object
res= (*itr)->Getdatafiletm(*tm);
printf("Timing=====%d\n",(*tm).month()); //header file CTime.h
mentions to have void month() const; method of class CTime)
Following is compile line:
g++-4.0 -g -o test_i386 Testing.o -lstdc++ -fexception -arch i386
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
I get following error:
/usr/bin/ld: Undefined symbols:
OPT::CTime::month() const
Please note I am not dynamic library(libopbx.dylib) creator & I am
just using it. In above compilation line, I also tried to change in
compiler from g++ to gcc when I made extension of file from cpp to mm
but no use.
Peter, not understood ur statement regarding second scenario "Setting
DYLD_LIBRARY_PATH to / is both strange and unnecessary". Bcoz after
setting it only, I was able to run the app successful in second
scenario.
Thanks,
Palav
On 12/7/07, Peter O'Gorman <email@hidden> wrote:
> parag vibhute wrote:
> > I am also facing certain type of problem. I tried two ways. First
> > scenario is as follows
> > 1. Dynamic library's install name is /usr/lib/libopbx.dylib.
> > 2. I set extension of source file (which is using that dynamic library)
> > to cpp & placed that dynamic library at executable path.
> > 3. In cpp file I am loading dynamic library at run time i.e. using
> > dlopen, dlclose etc. functions.(i.e. treating dynamic library is dynamic
> > dependant library)
> > 3. Compilation is successful.
> > 4. Now if I change extension to mm, it gives me error.
> > 5. But with cpp, there is one function for which I get error
> > "/usr/bin/ld: Undefined symbols:"
>
> Sorry, but there is not enough information here to give you a reasonable
> guesstimate about what went wrong. What are the undefined symbols? Can
> you post a short code snippit that demonstrates the problem? Could you
> show the build log?
>
> >
> > Second scenario is
> > 1. Dynamic library's install name is /usr/lib/libopbx.dylib.
> > 2. I set extension of source file (which is using that dynamic library)
> > to mm & placed that dynamic library at root("/") path.
> > 3. Now this time I am loading dyamic library at launch of my application
> > using -l flag of gcc(i.e. treating dynamic library as dependant library)
> > 3. Compilation is successful.
> > 4. Now I set value of DYLD_LIBRARY_PATH to "/"
> > 5. Run the code, it was successful.
> > 4. And also I do not get error for the function which I was getting in
> > first scenario.
> >
> > I am using Xcode 2.4.1 to build the application.
> >
> > My requirement is to avoid setting value of variable DYLD_LIBRARY_PATH;
> > for that I require to follow first path but in that case I am getting
> > error for a certain function. What should I do?
>
> Setting DYLD_LIBRARY_PATH to / is both strange and unnecessary. I assume
> that you want to have the library somewhere relative to the executable,
> in which case you should read earlier posts and manpages.
>
> Peter
> --
> Peter O'Gorman
> http://pogma.com
>
--
There are many things in your life that will catch your eye but only a
few will catch your heart....pursue those'.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden