Re: Cant get Quantlib to work with fedora 5 and gcc 4.1.1

Posted by Max Giolitti on
URL: http://quantlib.414.s1.nabble.com/Cant-get-Quantlib-to-work-with-fedora-5-and-gcc-4-1-1-tp5020p5026.html

Thanks Eric, by using g++ I was able to make some progress. Now I have the following problem. Using
====hello.cpp=========
#  include <ql/quantlib.hpp>

int main()
{
  printf("Hello World of Linux\n");
  exit(0);
}

and compiling using g++ -o hello hello.cpp I get a large list of errors. The first 2 are

/tmp/ccgkrAL1.o: In function `boost::shared_ptr<QuantLib::Observable>::operator->() const':
hello.cpp:(.text._ZNK5boost10shared_ptrIN8QuantLib10ObservableEEptEv[boost::shared_ptr<QuantLib::Observable>::operator->() const]+0x2f): undefined reference to `boost::assertion_failed(char const*, char const*, char const*, long)'
/tmp/ccgkrAL1.o: In function `boost::shared_ptr<QuantLib::DiscretizedAsset>::operator->() const':
hello.cpp:(.text._ZNK5boost10shared_ptrIN8QuantLib16DiscretizedAssetEEptEv[boost::shared_ptr<QuantLib::DiscretizedAsset>::operator->() const]+0x2f): undefined reference to `boost::assertion_failed(char const*, char const*, char const*, long)'

any wisdom? Sorry for all the amateur questions!

I installed the compiler automatically. The boost libraries where installed automatically, although I didn't know this at the time so I downloaded them and did
bjam "-sTOOLS=gcc" install

on top of what I had.

Max
eric ehlers <[hidden email]> wrote:
Hi Max

On 9/8/06, Max Giolitti wrote:
> I get an error also with the simple program luigi suggests.

OK, so there's a problem with the configuration of your compiler.
This is unrelated to QuantLib or Boost.

> luigi.c:1:19: error: utility: No such file or directory

Luigi advised you to name the file test.cpp, not luigi.c as you have
above. I wonder if you're mistakenly picking up a C environment
rather than a C++ environment?

For me, using the test code suggested by Luigi, whether I name the
file test.cpp or test.c, it compiles fine using the "g++" command.
If, however, I compile instead with the "gcc" command, I get the
exact same error message as you:

$ gcc test.c
test.c:1:19: error: utility: No such file or directory

Please confirm - what result do you get when performing the test
exactly as described by Luigi - naming the file "test.cpp" (even
though the extension seems not to matter) and using the command "g++
test.cpp"?

(gcc is the compiler, and g++ is a front end which configures the
environment for C++).

My FC5 installation includes gcc version 4.1.0. On my machine the
location of the "utility" standard header file is:

/usr/include/c++/4.1.0/utility

That's a the standard system include directory, i.e. g++ is configured
such that "include " finds the above file automatically with
no need to specify the location of the file.

How does the above compare to your environment?

When I installed FC from the CDs, I chose to install the developer
tools, and all of the above was configured automatically. How did you
install gcc, did you follow a similar procedure, or did you start
without gcc and later install it manually?

Regards,
Eric


Do you Yahoo!?
Next-gen email? Have it all with the all-new Yahoo! Mail.