If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Boost.Extension Tutorial 1 - Problem

So I just understood that the linker is complaining about not finding the necessary library. I know that -ldl would be the parameter to pass to the compiler. Unfortunately I do not know how to accomplish this in BJam. I think that I'll have a look at the BJam-documentation.

Anyway I also tried to compile the program by hand. That's what I did:

1. create dynamic library:

Code:

sudo g++ -shared -fPIC hello_world.cpp -o libhello.so

2. compile the main program:

Code:

sudo g++ -o hello main.cpp -ldl

And then I let it run. Unfortunately loading the dynamic library failed as the program printed "Library failed to open: libhello.so" - that's the string which the main function should print in this case.

Does anybody have a hint whether it could be because of a misconstruction in the source code or rather be caused by a missing compilation parameter, for instance?

Re: Boost.Extension Tutorial 1 - Problem

Anyway I also tried to compile the program by hand. That's what I did:

1. create dynamic library:

Code:

sudo g++ -shared -fPIC hello_world.cpp -o libhello.so

2. compile the main program:

Code:

sudo g++ -o hello main.cpp -ldl

And then I let it run. Unfortunately loading the dynamic library failed as the program printed "Library failed to open: libhello.so" - that's the string which the main function should print in this case.

Does anybody have a hint whether it could be because of a misconstruction in the source code or rather be caused by a missing compilation parameter, for instance?

You'll have to copy the library (libhello.so) to the same directory as the program. Normally, you copy everything to a 'bin' directory automatically after a build.

Cheers, D Drmmr

Please put [code][/code] tags around your code to preserve indentation and make it more readable.

As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky