I've checked more or less all the answers to this kind of problem wich seems quite usual when compiling with the new llvm package but I couldn't find any solution.
MacBook-Air-di-Manfredo:SINGLE_TETRAMER manfredo$ clang++ -v -Wall -O3 -g -fpic -c -lm grbyinsertion.cpp -I/Users/manfredo/Desktop/tesi/codice_tesi/oxDNA/src/Observables
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
clang: warning: -lm: 'linker' input unused
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -disable-free -disable-llvm-verifier -main-file-name grbyinsertion.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -gdwarf-2 -coverage-file /Users/manfredo/Desktop/tesi/codice_tesi/SINGLE_TETRAMER/grbyinsertion.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I /Users/manfredo/Desktop/tesi/codice_tesi/oxDNA/src/Observables -stdlib=libc++ -O3 -Wall -fdeprecated-macro -fdebug-compilation-dir /Users/manfredo/Desktop/tesi/codice_tesi/SINGLE_TETRAMER -ferror-limit 19 -fmessage-length 121 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o grbyinsertion.o -x c++ grbyinsertion.cpp
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin13.1.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/Users/manfredo/Desktop/tesi/codice_tesi/oxDNA/src/Observables
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks (framework directory)
End of search list.
grbyinsertion.cpp:63:9: warning: unused variable 'box_side' [-Wunused-variable]
number box_side = *this->_config_info.box_side;
^
grbyinsertion.cpp:156:16: note: in instantiation of member function 'grbyinsertion<float>::init' requested here
template class grbyinsertion<float>;
^
grbyinsertion.cpp:63:9: warning: unused variable 'box_side' [-Wunused-variable]
number box_side = *this->_config_info.box_side;
^
grbyinsertion.cpp:157:16: note: in instantiation of member function 'grbyinsertion<double>::init' requested here
template class grbyinsertion<double>;
^
2 warnings generated.
MacBook-Air-di-Manfredo:SINGLE_TETRAMER manfredo$ clang++ -v -shared -o grbyinsertion.so grbyinsertion.o -g2
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -dylib -arch x86_64 -macosx_version_min 10.9.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -o grbyinsertion.so grbyinsertion.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"_getInputFloat", referenced from:
grbyinsertion<float>::get_settings(input_file&, input_file&) in grbyinsertion.o
grbyinsertion<double>::get_settings(input_file&, input_file&) in grbyinsertion.o
"_getInputInt", referenced from:
grbyinsertion<float>::get_settings(input_file&, input_file&) in grbyinsertion.o
grbyinsertion<double>::get_settings(input_file&, input_file&) in grbyinsertion.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The function getinputfloat is defined in an header file like so:
int getInputFloat(input_file *inp, const char *skey, float *dest, int mandatory) {
int key = getInputKeyIndex(inp, skey, mandatory);
if(key != KEY_NOT_FOUND) *dest = atof(inp->values[key]);
else return KEY_NOT_FOUND;
return KEY_FOUND;
}
and is called by my program like so:
template<typename number>
void grbyinsertion<number>::get_settings(input_file &my_inp, input_file &sim_inp) {
float tmp;
if(getInputFloat(&my_inp, "bin", &tmp, 0) == KEY_FOUND) _bin = tmp;
getInputInt(&my_inp, "insertions", &_insertions, 0);
getInputFloat(&sim_inp, "T", &tmp, 1);
_T = tmp;
if(getInputFloat(&my_inp, "gr_min", &tmp, 0) == KEY_FOUND) _min = tmp;
if(getInputFloat(&my_inp, "gr_max", &tmp, 0) == KEY_FOUND) _max = tmp;
}
I've actually noticed that the header file where the getinputfloat function is defined is a .c file while most (i thought all of them) of the other files are .cpp, could this be the problem?
My llvm version is the 3.5 and I've upgraded all ports installed (via macports). Thanks.