Results 1 to 2 of 2

Thread: Member reference type issue with shared library

  1. #1
    Join Date
    Apr 2019
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Member reference type issue with shared library

    Hi everyone,

    First of all, I am French so sorry in advance for my English.

    I am working on a C++ project on Qt Creator 5.12 with the Spinnaker API ( https://www.ptgrey.com/Content/Image...tml/index.html)

    Basically, I need my project to work on both Linux(Ubuntu 18.04) and Windows(Windows 10) OS with this API.

    On Windows, everything is working fine but on Ubuntu, it seems that Qt doesn't recognize the header files of the library because i have the following compilation issues :
    /home/ntnu/Last/main.cpp:16: erreur : member reference type 'Spinnaker::SystemPtr' is not a pointer; did you mean to use '.'?
    /home/ntnu/Last/main.cpp:16: erreur : no member named 'GetCameras' in 'Spinnaker::SystemPtr'
    Here is the following piece of code ( which is an extract from the example code called "Acquisition" ) :

    Qt Code:
    1. #include "spinnaker/Spinnaker.h"
    2. #include "spinnaker/SpinGenApi/SpinnakerGenApi.h"
    3.  
    4. using namespace Spinnaker;
    5. using namespace Spinnaker::GenApi;
    6. using namespace Spinnaker::GenICam;
    7. using namespace std;
    8.  
    9. int main(int argc, char *argv[])
    10. {
    11.  
    12. SystemPtr system = System::GetInstance();
    13. CameraList camList = system->GetCameras();
    14. return 0;
    15. }
    To copy to clipboard, switch view to plain text mode 

    This is my .pro file :
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2019-04-26T13:02:00
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8.  
    9. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    10.  
    11. TARGET = Last
    12. TEMPLATE = app
    13.  
    14. INCLUDEPATH += /usr/include/spinnaker
    15.  
    16. LIBS += -lSpinnaker
    17.  
    18. # The following define makes your compiler emit warnings if you use
    19. # any feature of Qt which has been marked as deprecated (the exact warnings
    20. # depend on your compiler). Please consult the documentation of the
    21. # deprecated API in order to know how to port your code away from it.
    22. DEFINES += QT_DEPRECATED_WARNINGS
    23.  
    24. # You can also make your code fail to compile if you use deprecated APIs.
    25. # In order to do so, uncomment the following line.
    26. # You can also select to disable deprecated APIs only up to a certain version of Qt.
    27. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
    28.  
    29. CONFIG += c++11
    30.  
    31. SOURCES += \
    32. main.cpp \
    33. mainwindow.cpp
    34.  
    35. HEADERS += \
    36. include/AVIRecorder.h \
    37. include/ArrivalEvent.h \
    38. include/BasePtr.h \
    39. include/Camera.h \
    40. include/CameraBase.h \
    41. include/CameraDefs.h \
    42. include/CameraList.h \
    43. include/CameraPtr.h \
    44. include/ChunkData.h \
    45. include/DeviceEvent.h \
    46. include/Event.h \
    47. include/Exception.h \
    48. include/GUI/CameraSelection.h \
    49. include/GUI/CameraSelectionDlg.h \
    50. include/GUI/CameraSelectionWidget.h \
    51. include/GUI/PropertyGrid.h \
    52. include/GUI/PropertyGridDlg.h \
    53. include/GUI/PropertyGridWidget.h \
    54. include/GUI/RapidXML/rapidxml.hpp \
    55. include/GUI/RapidXML/rapidxml_iterators.hpp \
    56. include/GUI/RapidXML/rapidxml_print.hpp \
    57. include/GUI/RapidXML/rapidxml_utils.hpp \
    58. include/GUI/SpinnakerGUI.h \
    59. include/GUI/SpinnakerGUI_GTKmm.h \
    60. include/GUI/SpinnakerGUI_WPF.h \
    61. include/GUI/Viewer.h \
    62. include/GUI/ViewerDlg.h \
    63. include/GUI/ViewerWidget.h \
    64. include/Image.h \
    65. include/ImageEvent.h \
    66. include/ImagePtr.h \
    67. include/ImageStatistics.h \
    68. include/Interface.h \
    69. include/Interface/IArrivalEvent.h \
    70. include/Interface/ICameraBase.h \
    71. include/Interface/ICameraList.h \
    72. include/Interface/IChunkData.h \
    73. include/Interface/IDeviceEvent.h \
    74. include/Interface/IImage.h \
    75. include/Interface/IImageEvent.h \
    76. include/Interface/IImageStatistics.h \
    77. include/Interface/IInterface.h \
    78. include/Interface/IInterfaceEvent.h \
    79. include/Interface/IInterfaceList.h \
    80. include/Interface/ILoggingEvent.h \
    81. include/Interface/IRemovalEvent.h \
    82. include/Interface/ISystem.h \
    83. include/InterfaceEvent.h \
    84. include/InterfaceList.h \
    85. include/InterfacePtr.h \
    86. include/LoggingEvent.h \
    87. include/LoggingEventData.h \
    88. include/LoggingEventDataPtr.h \
    89. include/RemovalEvent.h \
    90. include/SpinGenApi/Autovector.h \
    91. include/SpinGenApi/Base.h \
    92. include/SpinGenApi/BooleanNode.h \
    93. include/SpinGenApi/CategoryNode.h \
    94. include/SpinGenApi/ChunkAdapter.h \
    95. include/SpinGenApi/ChunkAdapterDcam.h \
    96. include/SpinGenApi/ChunkAdapterGEV.h \
    97. include/SpinGenApi/ChunkAdapterGeneric.h \
    98. include/SpinGenApi/ChunkAdapterU3V.h \
    99. include/SpinGenApi/ChunkPort.h \
    100. include/SpinGenApi/CommandNode.h \
    101. include/SpinGenApi/Compatibility.h \
    102. include/SpinGenApi/Container.h \
    103. include/SpinGenApi/Counter.h \
    104. include/SpinGenApi/EnumClasses.h \
    105. include/SpinGenApi/EnumEntryNode.h \
    106. include/SpinGenApi/EnumNode.h \
    107. include/SpinGenApi/EnumNodeT.h \
    108. include/SpinGenApi/EventAdapter.h \
    109. include/SpinGenApi/EventAdapter1394.h \
    110. include/SpinGenApi/EventAdapterGEV.h \
    111. include/SpinGenApi/EventAdapterGeneric.h \
    112. include/SpinGenApi/EventAdapterU3V.h \
    113. include/SpinGenApi/EventPort.h \
    114. include/SpinGenApi/Filestream.h \
    115. include/SpinGenApi/FloatNode.h \
    116. include/SpinGenApi/FloatRegNode.h \
    117. include/SpinGenApi/GCBase.h \
    118. include/SpinGenApi/GCString.h \
    119. include/SpinGenApi/GCStringVector.h \
    120. include/SpinGenApi/GCSynch.h \
    121. include/SpinGenApi/GCTypes.h \
    122. include/SpinGenApi/GCUtilities.h \
    123. include/SpinGenApi/IBoolean.h \
    124. include/SpinGenApi/ICategory.h \
    125. include/SpinGenApi/IChunkPort.h \
    126. include/SpinGenApi/ICommand.h \
    127. include/SpinGenApi/IDestroy.h \
    128. include/SpinGenApi/IDeviceInfo.h \
    129. include/SpinGenApi/IEnumEntry.h \
    130. include/SpinGenApi/IEnumeration.h \
    131. include/SpinGenApi/IEnumerationT.h \
    132. include/SpinGenApi/IFloat.h \
    133. include/SpinGenApi/IInteger.h \
    134. include/SpinGenApi/INode.h \
    135. include/SpinGenApi/INodeMap.h \
    136. include/SpinGenApi/INodeMapDyn.h \
    137. include/SpinGenApi/IPort.h \
    138. include/SpinGenApi/IPortConstruct.h \
    139. include/SpinGenApi/IPortRecorder.h \
    140. include/SpinGenApi/IRegister.h \
    141. include/SpinGenApi/ISelector.h \
    142. include/SpinGenApi/ISelectorDigit.h \
    143. include/SpinGenApi/IString.h \
    144. include/SpinGenApi/IValue.h \
    145. include/SpinGenApi/IntRegNode.h \
    146. include/SpinGenApi/IntegerNode.h \
    147. include/SpinGenApi/Node.h \
    148. include/SpinGenApi/NodeCallback.h \
    149. include/SpinGenApi/NodeCallbackImpl.h \
    150. include/SpinGenApi/NodeMap.h \
    151. include/SpinGenApi/NodeMapFactory.h \
    152. include/SpinGenApi/NodeMapRef.h \
    153. include/SpinGenApi/Persistence.h \
    154. include/SpinGenApi/Pointer.h \
    155. include/SpinGenApi/PortImpl.h \
    156. include/SpinGenApi/PortNode.h \
    157. include/SpinGenApi/PortRecorder.h \
    158. include/SpinGenApi/PortReplay.h \
    159. include/SpinGenApi/PortWriteList.h \
    160. include/SpinGenApi/Reference.h \
    161. include/SpinGenApi/RegisterNode.h \
    162. include/SpinGenApi/RegisterPortImpl.h \
    163. include/SpinGenApi/SelectorSet.h \
    164. include/SpinGenApi/SpinTestCamera.h \
    165. include/SpinGenApi/SpinnakerGenApi.h \
    166. include/SpinGenApi/StringNode.h \
    167. include/SpinGenApi/StringRegNode.h \
    168. include/SpinGenApi/StructPort.h \
    169. include/SpinGenApi/Synch.h \
    170. include/SpinGenApi/Types.h \
    171. include/SpinGenApi/ValueNode.h \
    172. include/SpinVideo.h \
    173. include/SpinVideoDefs.h \
    174. include/Spinnaker.h \
    175. include/SpinnakerDefs.h \
    176. include/SpinnakerPlatform.h \
    177. include/System.h \
    178. include/SystemPtr.h \
    179. include/TransportLayerDefs.h \
    180. include/TransportLayerDevice.h \
    181. include/TransportLayerInterface.h \
    182. include/TransportLayerStream.h \
    183. include/TransportLayerSystem.h \
    184. include/spinc/CameraDefsC.h \
    185. include/spinc/ChunkDataDefC.h \
    186. include/spinc/QuickSpinC.h \
    187. include/spinc/QuickSpinDefsC.h \
    188. include/spinc/SpinVideoC.h \
    189. include/spinc/SpinnakerC.h \
    190. include/spinc/SpinnakerDefsC.h \
    191. include/spinc/SpinnakerGenApiC.h \
    192. include/spinc/SpinnakerGenApiDefsC.h \
    193. include/spinc/SpinnakerPlatformC.h \
    194. include/spinc/TransportLayerDefsC.h \
    195. include/spinc/TransportLayerDeviceC.h \
    196. include/spinc/TransportLayerInterfaceC.h \
    197. include/spinc/TransportLayerStreamC.h \
    198. include/spinc/TransportLayerSystemC.h \
    199. mainwindow.h
    200.  
    201. FORMS += \
    202. mainwindow.ui
    203.  
    204. # Default rules for deployment.
    205. qnx: target.path = /tmp/$${TARGET}/bin
    206. else: unix:!android: target.path = /opt/$${TARGET}/bin
    207. !isEmpty(target.path): INSTALLS += target
    208.  
    209. DISTFILES += \
    210. include/GUI/RapidXML/license.txt \
    211. include/GUI/RapidXML/manual.html \
    212. include/GUI/hicolor-icon-theme/share/icons/hicolor/index.theme
    To copy to clipboard, switch view to plain text mode 

    The main fact is that the example codes which are given with the API work, i try to compiled this piece of code with a Makefile and it is working and also it works on Windows so i don't know if this is a Qt issue or an issue due to the API.
    I also tried many things on the pro file with -L, cmake flags but nothing is changing.

    Thank you in advance for your time !

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,366
    Thanks
    36
    Thanked 1,535 Times in 1,486 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Member reference type issue with shared library

    Header not found generates a very different error.

    Unfortunately without seeing the declaration of SystemPtr it is hard to tell why you are getting the error you are seeing.

    It is probably a smart point of sorts which means it should have operator->()

    Cheers,
    _

Similar Threads

  1. Mingw-32bit Vs MSVC2013-64bit Shared library issue
    By Vikram.Saralaya in forum Qt Programming
    Replies: 3
    Last Post: 5th December 2015, 03:20
  2. Defining shared class member functions only once
    By Phlucious in forum General Programming
    Replies: 23
    Last Post: 16th January 2012, 22:17
  3. Class member reference
    By waynew in forum Newbie
    Replies: 2
    Last Post: 20th December 2009, 01:38
  4. How to properly return reference to class member?
    By agnus in forum General Programming
    Replies: 4
    Last Post: 6th December 2009, 02:41
  5. QT and my own shared library, undefined reference to ...
    By webquinty in forum General Programming
    Replies: 4
    Last Post: 4th March 2009, 15:09

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.