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
    #3

    Thank you SGaist for the reply, it solved that problem! I got through another two errors, however I now have 20 errors that all seem to be variations of the following:

    ".moc/gfortran/../../image_window.h:86:23: error: member access into incomplete type 'QMouseEvent'
    else if( event->button() == Qt::LeftButton ) {
    ^
    /Users/Rick/Qt5.2.1/5.2.1/clang_64/lib/QtWidgets.framework/Headers/qwidget.h:73:7: note: forward declaration of 'QMouseEvent'
    class QMouseEvent; "

    Any ideas?

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

      You are missing the QMouseEvent include

      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
        #5

        Thanks again SGaist, I'm truly grateful, your advice has been very helpful. I got through the rest of the errors, and arrived at another possibly linking error, which I'm thinking may be the last obstacle if it's a simple problem. Any advice?

        "/HEN_HOUSE/egs++/view$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -v -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.6 -o ../../bin/gfortran/egs_view.app/Contents/MacOS/egs_view .obj/gfortran/main.o .obj/gfortran/egs_visualizer.o .obj/gfortran/egs_track_view.o .obj/gfortran/moc_image_window.o -F/Users/Rick/Qt5.2.1/5.2.1/clang_64/lib -L../dso/gfortran -legspp -framework QtGui -framework QtCore -framework OpenGL -framework AGL
        Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
        Target: x86_64-apple-darwin13.0.2
        Thread model: posix
        "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -headerpad_max_install_names -macosx_version_min 10.6.0 -o ../../bin/gfortran/egs_view.app/Contents/MacOS/egs_view -lcrt1.10.6.o -L../dso/gfortran -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk .obj/gfortran/main.o .obj/gfortran/egs_visualizer.o .obj/gfortran/egs_track_view.o .obj/gfortran/moc_image_window.o -legspp -framework QtGui -framework QtCore -framework OpenGL -framework AGL -lstdc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a -F/Users/Rick/Qt5.2.1/5.2.1/clang_64/lib
        Undefined symbols for architecture x86_64:
        "QFileDialog::getOpenFileName(QString ()(), QString const&, QString const&, QString const&, QString const&, QFlagsQFileDialog::Option)", referenced from:
        _main in main.o
        "QApplication::exec()", referenced from:
        _main in main.o
        "QApplication::QApplication(int&, char**, int)", referenced from:
        _main in main.o
        "QApplication::~QApplication()", referenced from:
        _main in main.o
        "GeometryViewControl::setFilename(QString)", referenced from:
        _main in main.o
        "GeometryViewControl::setGeometry(EGS_BaseGeometry
        , std::vector<EGS_UserColor, std::allocator<EGS_UserColor> > const&, double, double, double, double, double, double, int)", referenced from:
        _main in main.o
        "GeometryViewControl::setTracksFilename(QString)", referenced from:
        _main in main.o
        "GeometryViewControl::GeometryViewControl(QWidget*, char const*, bool, QFlag)", referenced from:
        _main in main.o
        "GeometryViewControl::~GeometryViewControl()", referenced from:
        _main in main.o
        "QWidget::closeEvent(QCloseEvent*)", referenced from:
        vtable for ImageWindow in moc_image_window.o
        "QWidget::enterEvent(QEvent*)", referenced from:
        vtable for ImageWindow in moc_image_window.o ..."
        (it goes on)
        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
          #6

          Are you still using getOpenFileName in a wrong fashion ? Can you share the code ?

          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
            #7

            Of course!

            QString input_file = argc >= 2 ? argv[1] :
            QFileDialog::getOpenFileName(0,QString::null,0,0,
            "Select geometry definition file");

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

              You are trying to use the old Qt 3 getOpenFileName. Look at the documentation to see what to put where in the new version of the function

              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
                #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