Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. No viable conversion from 'const QString::Null' to 'QWidget *' Error help! [SOLVED]
Forum Updated to NodeBB v4.3 + New Features

No viable conversion from 'const QString::Null' to 'QWidget *' Error help! [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
20 Posts 2 Posters 12.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kogrady
    wrote on last edited by
    #9

    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.o

    ld: symbol(s) not found for architecture x86_64

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #10

      What is EGS_Input ? Where does it come from ? Custom library ? Official library ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kogrady
        wrote on last edited by
        #11

        Honestly, I'm not quite sure what you mean by custom vs official library, but it comes from the code I'm trying to compile and was written by its developers.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kogrady
          wrote on last edited by
          #12

          There is a class library included in my path, including egs_input.h

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #13

            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 ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kogrady
              wrote on last edited by
              #14

              No, unfortunately only 32 bit is available

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #15

                Then you will need to first build Qt in 32bit

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kogrady
                  wrote on last edited by
                  #16

                  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;
                  }"

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #17

                    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 ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kogrady
                      wrote on last edited by
                      #18

                      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."

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kogrady
                        wrote on last edited by
                        #19

                        Solved the problem by downgrading to a less recent Xcode version.. this was all unnecessary but I learned a bit and appreciate all your help!
                        Cheers!

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #20

                          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 :)

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved