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. Need to compile C library, PROJ4

Need to compile C library, PROJ4

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 4.6k 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.
  • M Offline
    M Offline
    marceloarguello700
    wrote on last edited by
    #1

    Hi I am making a GIS software, and then need to make some coordenates system translation.
    For the job is widely used the PROJ4 library https://github.com/OSGeo/proj.4.
    I include the principal header to my cpp file:
    extern "C"
    {
    #include <proj_api.h>
    }

    Also include many files of src folder to my qt project.
    I only need to use this functions:
    void pj_free(projPJ proj)
    projPJ pj_init_plus(const char *defn)
    int pj_transform(projPJ src_cs, projPJ dst_cs, long point_count,
    double *x, double *y, double *z)

    But when compile with QtCreator have the nexts errors:
    error: undefined reference to pj_etmerc' error: undefined reference to pj_s_etmerc'
    error: undefined reference to pj_rouss' error: undefined reference to pj_s_rouss'
    The problem is that names does not exist in the src folder or in the git hub folder.
    We couldn't find any code matching 'pj_etmerc'
    I try with 4-4.9.1 and 4-4.8 version and both give me the same errors.

    Where can find a list with only the neded files to use the above functions?
    something like project file

    What can be wrong?
    Te library is writed in C languaje it is very indescifrable to my knowledge.
    Please help me

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on last edited by
      #2

      Why don't you compile it and use it as a shared library (.dll, .so)? It would be much easier, I guess. And if you need the other functions in the future, they'll be readily available.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Huulivoide
        wrote on last edited by Huulivoide
        #3

        pj_s_rouss comes from src/proj_rouss.c
        Also the proj_api.h is already wrapped in extern "C" as you can see
        if you read it.

        But as Leanordo said you should build the whole thing and if you don't
        want to ship another dynamically linked file with your app, then you
        can just build a static library instead.

        1 Reply Last reply
        1
        • M Offline
          M Offline
          marceloarguello700
          wrote on last edited by marceloarguello700
          #4

          Thanks for the reply
          my main objetive is make a static library.
          If I knew how to do it??
          my class have a few functions

          bool vtCrsTransform::setSourceEPSG(int EPSG)
          {   search the EPSG id number in a xml file an then init the 
          projection pj_init_plus() with the definition string from the xml}
          
          bool vtCrsTransform::setTargetEPSG(int EPSG)
          {   search the EPSG id number in a xml file an then init the 
          projection pj_init_plus() with the definition string from the xml}
          
          QPointF vtCrsTransform::transform(QPointF pt)
          { apply pj_transform with the source an target projections}
          

          with this i want to make my statics library.

          But there is not something like project file with the neccesary file.

          Greetings

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            good start is to read
            https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application
            (section Creating a static library)

            Also you can choose New Project and select library and see what you get.

            I assume you got PROJ4 to compile and now are ready to turn it into a static library ?

            1 Reply Last reply
            -1
            • M Offline
              M Offline
              marceloarguello700
              wrote on last edited by
              #6

              Thanks, i can compile,
              Add the files one by one until succes.
              now have problem to use the library, but it is for another post.
              Greetings

              mrjjM 1 Reply Last reply
              0
              • M marceloarguello700

                Thanks, i can compile,
                Add the files one by one until succes.
                now have problem to use the library, but it is for another post.
                Greetings

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @marceloarguello700
                Super.
                If you did make a static library, then you can
                use
                LIBS += -L[path to lib] -l[name of lib]
                in the .pro file.
                or
                click on the .pro file so it opens up. then in the actual file, you right click and there
                is a Add Library which lets you add the 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