Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Qt MinGW and NXT++
Forum Updated to NodeBB v4.3 + New Features

Qt MinGW and NXT++

Scheduled Pinned Locked Moved 3rd Party Software
7 Posts 2 Posters 3.9k 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.
  • M Offline
    M Offline
    michprev
    wrote on last edited by
    #1

    Hello everybody,
    I am trying to use NXT++ with Qt to control LEGO Mindstorms robot.
    I've downloaded it "here":https://github.com/dbworth/nxt-plus-plus .

    Unfortunately it has been designed for Visual C++ so I tried to edit it for classic C++ (MinGW).

    There are changes I did:

    1. .pro file
      @

    added HEADERS and SOURCES

    SOURCES += main.cpp
    src/comm.cpp
    src/nxt++.cpp

    HEADERS += include/comm.h
    include/NXT++.h
    include/visatype.h
    include/fantom/iFile.h
    include/fantom/iFileIterator.h
    include/fantom/iModule.h
    include/fantom/iModuleIterator.h
    include/fantom/iNXT.h
    include/fantom/iNXTIterator.h
    include/fantom/platform.h
    include/fantom/tStatus.h

    instead of #pragma comment (lib, "lib/fantom.lib" ) added

    win32: LIBS += -L$$PWD/lib/ -lfantom

    INCLUDEPATH += $$PWD/include
    DEPENDPATH += $$PWD/include

    win32: PRE_TARGETDEPS += $$PWD/lib/fantom.lib

    instead of #include "stdafx.h" in nxt++.cpp and comm.cpp

    PRECOMPILED_HEADER += stdafx.h

    @

    1. platform.h (there are platform-related defines)

    original
    @
    /*!
    \file platform.h
    \brief This file contains platform-related defines.
    /
    /

    © Copyright 2005,
    National Instruments Corporation.
    All rights reserved.

    File: platform.h
    Originated: 23 June 2005
    */

    #ifndef fantom_platform_h
    #define fantom_platform_h

    #ifndef VISATYPE_HEADER
    #include "visatype.h"
    #endif

    #define nFANTOM100_kOSMacOSX 0
    #define nFANTOM100_kOSWin32 0

    #define nFANTOM100_kProcessorI386 0
    #define nFANTOM100_kProcessorPPC 0

    #define nFANTOM100_kCompilerMSVC 0
    #define nFANTOM100_kCompilerApple 0

    #if (( defined( GNUG ) || defined( GNUC )) && defined( APPLE ))

    #undef nFANTOM100_kOSMacOSX
    #define nFANTOM100_kOSMacOSX 1

    #undef nFANTOM100_kCompilerApple
    #define nFANTOM100_kCompilerApple ( GNUC * 10000
    + GNUC_MINOR * 100
    + GNUC_PATCHLEVEL )

    #if ( defined( ppc ))
    #undef nFANTOM100_kProcessorPPC
    #define nFANTOM100_kProcessorPPC 1

      #define nFANTOM100_kBigEndian         1
      #define nFANTOM100_kLittleEndian      0
    

    #elif ( defined( i386 ))
    #undef nFANTOM100_kProcessorI386
    #define nFANTOM100_kProcessorI386 1

      #define nFANTOM100_kBigEndian         0
      #define nFANTOM100_kLittleEndian      1
    

    #else
    #error Unknown processor.
    #endif

    #ifdef nFANTOM100_kExportSymbols
    #define nFANTOM100_kExport attribute ((section ("__TEXT,__export")))
    #else
    #define nFANTOM100_kExport
    #endif

    #elif ( defined( _MSC_VER ) && ( defined( _M_IX86 ) || defined( _M_I86 )))

    #undef nFANTOM100_kOSWin32
    #define nFANTOM100_kOSWin32 1

    #undef nFANTOM100_kCompilerMSVC
    #define nFANTOM100_kCompilerMSVC _MSC_VER

    #undef nFANTOM100_kProcessorI386
    #define nFANTOM100_kProcessorI386 1

    #ifdef nFANTOM100_kExportSymbols
    #define nFANTOM100_kExport __declspec(dllexport)
    #else
    #define nFANTOM100_kExport __declspec(dllimport)
    #endif

    #define nFANTOM100_kBigEndian 0
    #define nFANTOM100_kLittleEndian 1

    #else

    #error Unknown platform. // when i tried to compile, always ends here

    #endif

    #endif // fantom_platform_h
    @

    edited
    @
    /*!
    \file platform.h
    \brief This file contains platform-related defines.
    /
    /

    © Copyright 2005,
    National Instruments Corporation.
    All rights reserved.

    File: platform.h
    Originated: 23 June 2005
    */

    #ifndef fantom_platform_h
    #define fantom_platform_h

    #ifndef VISATYPE_HEADER
    #include "../visatype.h"
    #endif

    #define nFANTOM100_kOSMacOSX 0
    #define nFANTOM100_kOSWin32 0

    #define nFANTOM100_kProcessorI386 0
    #define nFANTOM100_kProcessorPPC 0

    #define nFANTOM100_kCompilerMSVC 0
    #define nFANTOM100_kCompilerApple 0

    #undef nFANTOM100_kOSWin32
    #define nFANTOM100_kOSWin32 1

    #undef nFANTOM100_kCompilerMSVC
    #define nFANTOM100_kCompilerMSVC _MSC_VER

    #undef nFANTOM100_kProcessorI386
    #define nFANTOM100_kProcessorI386 1

    #ifdef nFANTOM100_kExportSymbols
    #define nFANTOM100_kExport __declspec(dllexport)
    #else
    #define nFANTOM100_kExport __declspec(dllimport)
    #endif

    #define nFANTOM100_kBigEndian 0
    #define nFANTOM100_kLittleEndian 1

    #endif // fantom_platform_h
    @

    So what's the problem?

    !http://s22.postimage.org/4za42ypsx/qt_nxt.png(Error 1)!

    And when I try to remove (from .pro file)
    @PRECOMPILED_HEADER += stdafx.h@

    !http://s22.postimage.org/50k1wdrmp/qt_nxt_2.png(Error 2)!

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      You are aware of the possibility that you are not stuck with MinGW?
      You can download an express version of MSVC for free. It may be combined with Qt creator with msvc as tool chain.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        michprev
        wrote on last edited by
        #3

        Yes but I hoped that I can get it work on Symbian.

        Edit:
        Symbian GCCE toolchain does not have any problem with stdafx.h but there is still problem with undefined reference.
        These errors looks same as I got when I forgot to add pragma comment in MSVC. So there should be problem with reading phantom.lib file?

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          I have no experience with Symbian.

          Did you check out comm.cpp?
          The only explanation I can offer is that part of the source might be excluded from compiling with #if

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • M Offline
            M Offline
            michprev
            wrote on last edited by
            #5

            It is problem of the .lib file. It has been built in Microsoft Visual Studio. It cannot be used with MinGW GCC. It does not matter if it's for Symbian or Windows.

            When I try to run the application in Symbian simulator with Visual C++ toolchain everything works.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              Yes, you have to use the proper compiler and its version for compatibility.
              You cannot mix between versions of msvc. And you cannot mix MinGW 4.7 with MinGW 4.6 at least. So, you need a recompilation of the libs.

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              0
              • M Offline
                M Offline
                michprev
                wrote on last edited by
                #7

                OK, thank you very much.

                I believe that Lego support will be willing to help me to get the proper library.

                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