Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linker error #4

Open
rwst opened this issue Nov 4, 2015 · 3 comments
Open

linker error #4

rwst opened this issue Nov 4, 2015 · 3 comments

Comments

@rwst
Copy link

rwst commented Nov 4, 2015

This:

g++ -std=c++11 -o flint flint.cpp -lflint

with flint.cpp:

#include <flint/fmpq_poly.h>
#include <benchpress/benchpress.hpp>
#include "series-benchmark.h"

int main()
{
    fmpq_poly_t x, y, z;
    fmpq_poly_init (x);
    fmpq_poly_init (y);
    fmpq_poly_init (z);

    fmpq_poly_set_coeff_ui(x, 1, 1);
    fmpq_poly_sin_series(x, x, N);
    fmpq_poly_set_coeff_ui(y, 1, 1);
    fmpq_poly_cos_series(y, y, N);

    BENCHMARK("flint", [&](benchpress::context* ctx) {
        for (size_t i = 0; i < ctx->num_iterations(); ++i) {
            fmpq_poly_mullow (z , x , y, N) ;
        }
    })
    fmpq_poly_clear (x);
    fmpq_poly_clear (y);
    fmpq_poly_clear (z);

    return 0;
}

produces

/tmp/ccSDe92z.o: In function `benchpress::registration::get_ptr()':
flint.cpp:(.text._ZN10benchpress12registration7get_ptrEv[_ZN10benchpress12registration7get_ptrEv]+0xa): undefined reference to `benchpress::registration::d_this'
flint.cpp:(.text._ZN10benchpress12registration7get_ptrEv[_ZN10benchpress12registration7get_ptrEv]+0x42): undefined reference to `benchpress::registration::d_this'
flint.cpp:(.text._ZN10benchpress12registration7get_ptrEv[_ZN10benchpress12registration7get_ptrEv]+0x49): undefined reference to `benchpress::registration::d_this'
collect2: error: ld returned 1 exit status

Please Help!

@rwst
Copy link
Author

rwst commented Nov 5, 2015

Okay, this error is resolved by adding this line to my source cpp:

benchpress::registration* benchpress::registration::d_this;

This ticket should add something about it to the readme.

@rwst
Copy link
Author

rwst commented Nov 5, 2015

No actually I needed gcc-4.9. 4.8 will not suffice for benchpress!

@cjgdev
Copy link
Owner

cjgdev commented Aug 12, 2016

@rwst I would be willing to accept a pull request with the documentation update if you are offering to submit one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants