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

C++ shared object library linker issue with declaration/definition #63

Open
Jintram opened this issue Feb 14, 2012 · 0 comments
Open

C++ shared object library linker issue with declaration/definition #63

Jintram opened this issue Feb 14, 2012 · 0 comments

Comments

@Jintram
Copy link

Jintram commented Feb 14, 2012

This is fixed, but I've put this in tracker because a) we have a fix but don't know exactly how it works and b) perhaps we might run into this problem again and it's convenient to keep track of (fixed) problems.

The issue

Though compiling of "affected" branches did work on desktops, on the cluster we had the following issue.

The code did compile, but after compilation we would get the message:

ImportError <>.so undefined symbol <either MIN_TERMS or MAX_TERMS>

A specific example:

ImportError: ./_greens_functions.so: undefined symbol: _ZN22GreensFunction1DRadAbs14MAX_TERMS_TESTE

This can be fixed either by using static_cast on all occurences of MIN_TERMS and MAX_TERMS of the 1D functions, or by adding the next two lines to the .cpp files of the 1D functions (right after the includes, see current version of the code):

const unsigned int GreensFunction1DAbsAbs::MAX_TERMS;
const unsigned int GreensFunction1DAbsAbs::MIN_TERMS;

(With appropriate name of GFs.) The latter approach is what is done with other variables in used in the (other) Green's functions. It seems it has something to do with the variables not being defined before (http://bytes.com/topic/python/answers/133013-extending-python-undefined-symbol-error-import, http://wiki.answers.com/Q/What_is_the_difference_between_declaration_and_a_definition_in_C), but as mentioned we're not entirely sure how this works.

M.

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

No branches or pull requests

1 participant