Menu

libnodave & QT3

Help
2007-03-14
2013-05-09
  • Nobody/Anonymous

    I need to use libnodave library with a qt project. I don't know witch file to include (nodave.h setport.h ecc...) and how to compile because I get a lot of error.

    Can you help me?

    THANKS

     
    • Nobody/Anonymous

      Sorry, now I know how to do (I think) :-)

      Ask me if u want, now I've no time to explain.

      I'd like to be in contact with someone who use libnodave...
      if someone use jabber u can fine me in luca_tgmx@jabber.org

       
    • Nobody/Anonymous

      When I compile using QT I get a message of "multiple definition of SCP_open" ecc...

      Can u tell me why?

       
    • Nobody/Anonymous

      I do not know anything about QT programming, but I guess:
      1. It is a problem of including the same header file more than once. Make sure that you include nodave.h, openS7online.h only once.
      2. Qt happens to have a function named SCP_open. I don't know quick solution in this case.

      Thomas

       
    • Nobody/Anonymous

      thanks for answare.
      I've done a lot of test and I seen that if I include in my qt project nodavesimple.h it works fine (it compile) but if I include nodave.h I get some error.
      Other error that I get including nodave.h is:
      In file included from /usr/lib/qt/include/qwidget.h:44,
                       from /usr/lib/qt/include/qdesktopwidget.h:40,
                       from /usr/lib/qt/include/qapplication.h:42,
                       from thread.cpp:8:
      /usr/lib/qt/include/qpaintdevice.h:98: error: expected unqualified-id before "int"

      It seems a problem of corrupted header.

      I think in nodave.h there are error that aren't in nodavesimple.h .

      don't you think?

       
    • Nobody/Anonymous

      this is always me...

      Now I know the problem with QT:
      in nodave.h at line 1046 ther is "#define HANDLE int" but HANDLE is used in QT so it generate error. Now I've commented thi line and I resolved this problem, but I always have the previous error:
      .obj/form1.o(.bss+0x14): multiple definition of `SCP_get_errno'
      .obj/main.o(.bss+0x0): first defined here
      .obj/form1.o(.bss+0x18): multiple definition of `SCP_receive'
      .obj/main.o(.bss+0x4): first defined here
      .obj/form1.o(.bss+0x1c): multiple definition of `SCP_send'
      .obj/main.o(.bss+0x8): first defined here
      .obj/form1.o(.bss+0x20): multiple definition of `SCP_close'
      .obj/main.o(.bss+0xc): first defined here
      .obj/form1.o(.bss+0x24): multiple definition of `SCP_open'
      .obj/main.o(.bss+0x10): first defined here

       
    • Nobody/Anonymous

      As I hope to have stated in FAQ and/or Readme files, nodave.h is the complete header file which also reflects inner structures of the library while nodavesimple.h contains only the API (for normal purposes). If they differ, most likely nodave.h is right or the library itself would be broken.
      My test applications use nodave.h.
      nodavesimple.h is only there because some users dismayed because of it's size.
      If your application works with nodavesimple.h, use it and you are done.
      Because the problem is with SCP_xx functions, it may be that nodavesimple.h is out of date and does not have the SCP_ stuff. This would mean you cannot do s7online protocol when using it.
      Next, but that's guesswork, if you get errors like
      .obj/form1.o(.bss+0x24): multiple definition of `SCP_open'
      .obj/main.o(.bss+0x10): first defined here
      it may be that you:
      - must not include nodave.h in the sources of both, main.o and forms.o
      - that you could do that in principle, but that some definition (e.g. of HANDLE) preceeds the inclusion of nodave.h in one source file but not in the other.
      If QT defines a HANDLE that is different from HANDLE from windows.h, I cannot help you, but other people working with QT must have solved that before.
      Remember: all nodave stuff is plain old C, not C++!

       
    • Nobody/Anonymous

      OK thanks,

      I've only another little question...

      I ve resolved all my problem in this way:

      1) in nodave.h I changed all occurence of HANDLE with HANDLE_1 and now I don't get the error from QT /usr/lib/qt/include/qpaintdevice.h:98: error: expected unqualified-id before "int"

      2) I deleted all SCP_XX function and now I don't get the error
      multiple definition of `SCP_open'

      I only need to comunicate with plc using cp-343 can u tell me if I'll get problem using my modified libnodave library?

      THANKS

       
    • Nobody/Anonymous

      It should work

       
    • Nobody/Anonymous

      BTW: Do you use Linux or Windows?
      /usr/lib/... lokks like Linux
      But how would you than have handles in nodave.h?

       
    • Nobody/Anonymous

      I use Linux. I compiled with -DLINUX and -DDAVE_LITTLE_ENDIAN parameters. I don't know why I have handles in nodave.h  but the error was /usr/lib/qt/include/qpaintdevice.h:98: error: expected unqualified-id before "int" and in this file at line 98 there is:

      #elif defined(Q_WS_X11)
          virtual Qt::HANDLE  handle() const;               <------- line 98
          virtual Qt::HANDLE  x11RenderHandle() const;
      ....

      so I thought it was the problem.

       
    • Nobody/Anonymous

      This is me again... :-)

      I think this is usefull for people who use nodave with QT3:

      I've made another change in nodave.h, I've commented the line where there is "#pragma pack(1)" because I get segmentation fault using QCustomEvent and now it's ok.

      But I don't know why. I found this solution commenting line by line :-)

       
    • Nobody/Anonymous

      I'm developing an application with libnodave and qt3.

      While compiling I get this error:
      /usr/lib/qt/include/private/qucom_p.h:142: error: duplicate 'unsigned'
      /usr/lib/qt/include/private/qucom_p.h:142: error: multiple types in one declaration
      /usr/lib/qt/include/private/qucom_p.h:142: error: declaration does not declare anything
      /usr/lib/qt/include/private/qucom_p.h:143: error: duplicate 'unsigned'
      /usr/lib/qt/include/private/qucom_p.h:143: error: duplicate 'short'
      /usr/lib/qt/include/private/qucom_p.h:143: error: declaration does not declare anything

      I saw that the problem was a define in nodave.h:
      #define uc unsigned char
      #define us unsigned short

      because a qt library usa "uc" and "us" as a name of a variable.

      I solved the problem replacing all occurence of "uc" and "us" with "unsigned char" and "unsigned short".

       

Anonymous
Anonymous

Add attachments
Cancel