No viable conversion from 'const QString::Null' to 'QWidget *' Error help! [SOLVED]
-
Okay, I decided to go another route and use macports to install qt3 and recompile. I'm about in the same place, I still get the "ld:symbol not found for architecture x86_64" message at the end, with only a few "Undefined Symbols" messages:
/usr/bin/clang++ -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -arch x86_64 -prebind -o ../../bin/gfortran/egs_view .obj/gfortran/main.o .obj/gfortran/egs_visualizer.o .obj/gfortran/egs_track_view.o .obj/gfortran/viewcontrol.o .obj/gfortran/saveimage.o .obj/gfortran/clippingplanes.o .obj/gfortran/moc_image_window.o .obj/gfortran/moc_viewcontrol.o .obj/gfortran/moc_saveimage.o .obj/gfortran/moc_clippingplanes.o -L/opt/local/lib -L/opt/local/lib/qt3/lib -L/opt/local/lib -L/Users/Rick/egsnrc/HEN_HOUSE//egs++//dso/gfortran -legspp -lqt-mt -lXext -lX11 -lm
Undefined symbols for architecture x86_64:
"EGS_Input::takeInputItem(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)", referenced from:
_main in main.o
GeometryViewControl::reloadInput() in viewcontrol.o
"EGS_Input::getInput(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&) const", referenced from:
_main in main.o
GeometryViewControl::reloadInput() in viewcontrol.o
"EGS_Input::getInput(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, double&) const", referenced from:
_main in main.o
GeometryViewControl::reloadInput() in viewcontrol.old: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-
What is EGS_Input ? Where does it come from ? Custom library ? Official library ?
-
By custom I meant a library you wrote yourself and official some 3rd party like e.g. openssl.
So that that is 3rd party library, and from the look of it you only have it in 32bit, can you get it in 64 ?
-
Then you will need to first build Qt in 32bit
-
Thanks again SGaist. I tried that, still got more of the same error (had to compile with qt 5.2 again, can't install qt3 via macports).
Perhaps you could help me out with something else though, I'm compiling a different gui and receiving the error below. I recognize that it doesn't like either constructor, but given the relevant code in egs_tools.cpp (below), do you have any advice on how to change the definition of "target"?
Thanks again!
"../egs_install/src/egs_tools.cpp:255:15: error: call to constructor of 'std::ofstream' (aka 'basic_ofstream<char>') is ambiguous
std::ofstream out( target, ios::out | ios::binary );
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/fstream:1136:14: note: candidate constructor
explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/fstream:1138:14: note: candidate constructor
explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out); "relevant snippet of egs_tools.cpp
" copies a char variable into a text file
/
bool copy2file(const char source, const QString& target)
{
std::ofstream out( target, ios::out | ios::binary );
if (!out) return false;
char ch;
while( *source ){
ch = *source;
source++;
out.put( ch );
}
out.close();
return true;
}" -
The first thing that surprises me is why use ofstream if you are using QString for copy2file ? You should use QFile and QDataStream, it would be simpler.
Anyway, you are trying to pass a QString to ofstream that expects a const char *, not a good idea. You need to convert the QString to a const char * (look at e.g. toLatin1())
Are you writing that EGS library ?
-
Thanks SGaist, that solved that problem. No, I am not writing this library, I am a user. This was written several years ago.
Still unfortunately not able to compile the other gui I described earlier, which had some kind of architecture x86_64 linker problem. I took your advice however and tried building qt3 in 32 bit. Since I could not build qt3 in 32 bit (I used macports to install it before, which gave the errors in my previous post.. I could not successfully build it from source), I built qt 5.2.1 in 32 bit using the ./configure -m32 option. This resulted in a the same error, "ld: symbol(s) not found for architecture x86_64."
-
You're welcome !
Now that you got going, please update the thread title prepending [solved] so other forum users may know a solution has been found :)