Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. [Solved] Simple initializer problem
QtWS25 Last Chance

[Solved] Simple initializer problem

Scheduled Pinned Locked Moved C++ Gurus
14 Posts 5 Posters 7.7k Views
  • 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.
  • F Offline
    F Offline
    franku
    wrote on last edited by
    #4

    Additionally you could run qmake again.

    If you want to be clear which code is used by the preprocessor you want to use a statement like this:

    @#error "Simple"@

    But I don't understand why you define the EXPORT and the IMPORT macro when using only the EXPORT in your class definition.

    This, Jen, is the internet.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Thanatos.jsse
      wrote on last edited by
      #5

      Hi franku,

      You are right, but DEFINES qmake adds the values of this variable as compiler C preprocessor macros (-D option). So, when I add the line:
      @# interface_mngr.pro
      DEFINES +=
      INTERFACEMNGRLIB_LIBRARY@

      it add

      @#define INTERFACEMNGRLIB_LIBRARY@

      Thank you for your time.

      PD: When create shared lib follow this "link":http://doc.qt.nokia.com/4.7-snapshot/sharedlibrary.html#header-file-considerations

      1 Reply Last reply
      0
      • F Offline
        F Offline
        franku
        wrote on last edited by
        #6

        Hi, I know. This is the reason why I asked you to rebuild your makefiles using qmake. Just to be shure having the -D commandline parameter being passed to the compiler. Read the contents of the link again carefully to see where the difference is to your code.

        You can use the #error to stop the preprocessor if you want to know which line is really evaluated.

        This, Jen, is the internet.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          Thanatos.jsse
          wrote on last edited by
          #7

          I have found a strange issue:

          I delete all references to InterfaceMngr in the file core.h and core.cpp, and found that the library compile without errors, but when I try to use it, give the compile error referenced here before.

          BR,

          1 Reply Last reply
          0
          • A Offline
            A Offline
            akonradwesolutions
            wrote on last edited by
            #8

            Shouldn't it be:

            @
            #if defined(INTERFACEMNGRLIB_LIBRARY)

            define INTERFACEMNGR_EXPORT Q_DECL_EXPORT

            #else

            define INTERFACEMNGR_EXPORT Q_DECL_IMPORT

            #endif
            @

            otherwise, INTERFACEMNGR_EXPORT will not be defined when you try to use the exported symbol.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              Thanatos.jsse
              wrote on last edited by
              #9

              Hi Arnold,

              I have other two similars definitions but don't have any problem.
              The libraries "ModuleMngr":https://github.com/thanatosJSSE/Sipred/blob/master/src/managers/module/modulemngr.h and "PluginMngr":https://github.com/thanatosJSSE/Sipred/blob/master/src/managers/plugin/pluginmngr.h.

              Thank you.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                akonradwesolutions
                wrote on last edited by
                #10

                In both pluginmngr_global.h and modulmngr_global.h the declaration looks like this

                @
                #ifndef PLUGINMNGR_GLOBAL_H
                #define PLUGINMNGR_GLOBAL_H

                #include <QtCore/QtGlobal>

                #if defined(PLUGINMNGRLIB_LIBRARY)

                define PLUGINMNGR_EXPORT Q_DECL_EXPORT

                #else

                define PLUGINMNGR_EXPORT Q_DECL_IMPORT

                #endif

                #endif // PLUGINMNGR_GLOBAL_H
                @

                which is exactly what i suggested.

                Regards,
                Arnold

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  Neutron Stein
                  wrote on last edited by
                  #11

                  If i am not wrong there is a missing ";" after Q_DECLARE_PRIVATE(InterfaceMngr):
                  @
                  private:
                  Q_DECLARE_PRIVATE(InterfaceMngr) ; //here

                  };
                  @

                  Never Seen !

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    Thanatos.jsse
                    wrote on last edited by
                    #12

                    That's right, interfacemngr have his own interfacemngr_global.h.

                    And this looks like you suggest.

                    BR,

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      Thanatos.jsse
                      wrote on last edited by
                      #13

                      [quote author="Neutron Stein" date="1343136256"]If i am not wrong there is a missing ";" after Q_DECLARE_PRIVATE(InterfaceMngr):
                      @
                      private:
                      Q_DECLARE_PRIVATE(InterfaceMngr) ; //here

                      };
                      @[/quote]

                      There is no problem, I tried that too, without results.
                      I found that this library is compiled, but when I try to use it give me that error.

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        Thanatos.jsse
                        wrote on last edited by
                        #14

                        Ok,

                        Thank everyone that helped me to take a look to mi code.
                        Well the problem was a personal mistake:

                        @#if defined(INTERFACEMNGRLIB_LIBRARY)

                        define INTERFACEMNGR_EXPORT Q_DECL_EXPORT

                        #else

                        define INTERFACEMNGR_IMPORT Q_DECL_IMPORT <---- ERROR!!!

                        #endif@

                        Must be EXPORT like Arnold said

                        BR,

                        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