[Proj] Re: Compiling Eric Millers proj_api.dll

Tony Seiscons gu2l5z3wt001 at sneakemail.com
Mon Sep 20 00:25:16 EDT 2004


I have got a bit further with this but have not yet been successful.  I have
put the Proj files in c:\msys\1.0\Proj.  The proj.exe, proj.dll, libproj.a
and *.o files are in c:\msys\1.0\Proj\bin and the*.c and *.h files are in
c:\msys\1.0\Proj\proj_4.4.8\src.  If I put proj_api.c in c:\msys\1.0\Proj
and in mSys I change directories to /proj and then execute on the command
line the following:

$ gcc proj_api.c -O -Wall -W -mwindows \
           -DBUILD_DLL=1 -I. -I../proj/proj-4.4.8/src

I get:

C:/DOCUME~1/Tony/LOCALS~1/Temp/ccOGaaaa.o(.text+0xa):proj_api.c: \
            undefined reference to `pj_init_plus'
C:/DOCUME~1/Tony/LOCALS~1/Temp/ccOGaaaa.o(.text+0x1e):proj_api.c: \
        undefined reference to `pj_free'
C:/DOCUME~1/Tony/LOCALS~1/Temp/ccOGaaaa.o(.text+0x44):proj_api.c: \
        undefined reference to `pj_transform'
etc. followed by
c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.3/../../../libmingw32.a(main.o) \
    (.text+0x97):main.c: undefined reference to `WinMain at 16'

If I execute:

$ gcc proj_api.c -O -Wall -W -mwindows \
            -DBUILD_DLL=1 -I. -I../proj/proj-4.4.8/src

I get

proj_api.c:63:22: projects.h: No such file or directory
proj_api.c:64:22: proj_api.h: No such file or directory
proj_api.c:75: warning: type defaults to `int' in declaration of `projPJ'
etc.

indicating, I guess that it can't find the header files listed in proj_api.c

So If the compiler is picking up projects.h and proj_api.h, why all the
undefined references to whatever.

I had a similar problem using Dev-C++ which is an IDE.  If I included only
the proj.c file in the IDE project I got a series of "undefined reference"
errors when I tried to compile it, even if I got the include directories
right.  To get proj.c to compile I had to drag and drop all of the *.c and
*.h files into the IDE project (except cs2cs.c, nad2nad.c etc.).

If I use Eric Millers make file with the include and lib paths suitably
modified I get the same series of "undefined reference" errors followed by:

c:\mingw\bin\dllwrap.exe: no export definition file provided.
Creating one, but that may not be what you want
c:\mingw\bin\dllwrap.exe: c:\mingw\bin\gcc exited with status 1
make: *** [proj_api.dll] Error 1

Any help would be much appreciated as I have struck a bit of a brick wall
with this one.

In reply to Eric's reply to my post:-

The gtProAPI name is mine for proj_api. What I am trying to do is compile
the proj_api.dll/proj.dll to different file names with a different NAD path
so that they can be unique to the program that I am writing that uses them
and isolated from other installations of proj that may be on a system. In
this way I hope to ensure that proj_api.dll wrapper doesn't call a version
of proj.dll against which it has not been compiled. In other word I'll have
a gtProjAPI.dll calling gtproj.dll with the NAD files in, for example
C:\Programme Files\MyProg\MyNAD by default.


"Eric Miller" <EMiller at dfg.ca.gov> wrote in message
news:s14aa023.020 at dfg.ca.gov...
> Well, I don't know exactly what you're doing, but with the options you
> listed, you didn't specify the -DBUILD_DLL=1 flag.  That part is
> important since it controls whether the functions are defined as exports
> or imports.  I don't know where gtProAPI is coming from.  It's not part
> of anything I wrote.
>
> Eric G. Miller
> GIS Analyst
> Wildlife and Habitat Data Analysis Branch
> Department of Fish and Game
>
> >>> "Tony Seiscons" <gu2l5z3wt001 at sneakemail.com> 9/14/2004 11:57:38 PM
> >>>
> I am trying to recompile Eric Millers proj_api.dll so that, a) I can
> update
> it to 4.8.8 and whatever comes next and, b) so that I can use
> different
> names for proj.dll, proj_api.dll and the NAD directory so that I can
> isolate
> it from other versions of proj and proj.dll.
>
> I have successfully compiled and tested proj.exe 4.8.8 using Dev C++,
> gcc/MinGW/MSys however I am having difficulty compiling proj_api.dll.
> Whenever I compile it the system compiles and links all of the proj
> files as
> well  to produce a 248kB file insured of a 28kB one and the
> proj_api.def
> file does not have any EXPORTS.  (Naturally it doesn't work).  I have
> installed the compiler options -O -Wall -W -mwindows that Eric has in
> his
> makefile and tried a few other options to no avail.  I have also tried
> compiling from the command line using his Makefile but I get the error
> C:\Dev-Cpp\usr\Proj\proj_api\Makefile [Build Error]  No rule to make
> target
> `gtProAPI.o', needed by `gtProAPI.dll'.
>
> Any help would be appreciated as I am not very familiar with C and C
> compilers and I'd like to get back to my VB project!
>
> Tony
>
>
>
> _______________________________________________
> Proj mailing list
> Proj at xserve.flids.com
> http://xserve.flids.com/mailman/listinfo/proj
> _______________________________________________
> Proj mailing list
> Proj at xserve.flids.com
> http://xserve.flids.com/mailman/listinfo/proj
>







More information about the Proj mailing list