You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Joachim Ziegler <zi...@mpi-sb.mpg.de> on 2008/02/05 13:42:45 UTC

Re: Newbie question: Compiling helloworld-APR.c under Windows

Hello William,

thank you for your quick reply last week.

Unfortunately I still cannot get helloworld-APR.c running under Windows.

William A. Rowe, Jr. wrote:
> If you used a -win32-src.zip file, and run nmake against the
> makefile.win, you shouldn't be having problems.

I'm not quite sure to understand what you mean by this. Yes, I have 
downloaded the win32-src.zip file and followed the instructions in the 
section "Developer Studio Workspace/Microsoft Development Environment 
IDE Build" on

http://apr.apache.org/compiling_win32.html

to build the libs.

I have also successfully built and run the apr/test/aprtest.dsw project.

> 
> If you import into VS2005/2008, there are dependency hassles,
> but you can usually work those out by reviewing the build
> target and it's dependencies.  APR alone is pretty easy.

Sorry, I do not understand what you say here. It might well be that I 
just know too little about Windows programming in general. (I come from 
a UNIX background.)

> Finally, apr.h defines those APR_DECLARE macros to be .dll
> imports if you do nothing.  You do need to declare -D WIN32
> of course.

I have found out by myself that I have to declare this WIN32 macro by 
following the compiler's error messages into the apr.h file. You say "of 
course": Is this something I should have known beforehand because it is 
customary in Windows development? If not so: I cannot read anything 
about this in the official documentation!?

Anyway, now my helloworld compiles, but it does not link. I get the 
following error messages:

------ Build started: Project: TestAPR, Configuration: Debug Win32 ------
Linking...
try-helloworld-APR.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' 
due to '/OPT:ICF' specification
apr-1.lib(start.obj) : error LNK2019: unresolved external symbol 
__imp__WSACleanup@0 referenced in function _apr_initialize@0
apr-1.lib(start.obj) : error LNK2019: unresolved external symbol 
__imp__WSAStartup@8 referenced in function _apr_initialize@0
apr-1.lib(apr_snprintf.obj) : error LNK2019: unresolved external symbol 
__imp__ntohl@4 referenced in function _conv_in_addr
apr-1.lib(sockaddr.obj) : error LNK2001: unresolved external symbol 
__imp__ntohl@4
apr-1.lib(sockaddr.obj) : error LNK2019: unresolved external symbol 
__imp__htons@4 referenced in function _apr_sockaddr_vars_set
apr-1.lib(sockaddr.obj) : error LNK2019: unresolved external symbol 
__imp__ntohs@4 referenced in function _get_local_addr
apr-1.lib(sockaddr.obj) : error LNK2019: unresolved external symbol 
__imp__WSAGetLastError@0 referenced in function _get_local_addr
[...]

Can someone please help me?

Thank you very much,
Joachim

Re: Newbie question: Compiling helloworld-APR.c under Windows

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Joachim Ziegler wrote:
> 
> I'm not quite sure to understand what you mean by this. Yes, I have 
> downloaded the win32-src.zip file and followed the instructions in the 
> section "Developer Studio Workspace/Microsoft Development Environment 
> IDE Build" on
> 
> http://apr.apache.org/compiling_win32.html
> 
> to build the libs.

Sounds great - give me a day or two to freshen that document, and I'll
post when it's good to follow.

I'll be sure to add something about consuming libapr on win32 as well.

Bill

Re: Newbie question: Compiling helloworld-APR.c under Windows

Posted by Issac Goldstand <ma...@beamartyr.net>.
William A. Rowe, Jr. wrote:
> Issac Goldstand wrote:
>> Sounds like the liker wants Winsock linked in (ws2_32.lib).  Not sure 
>> why your application wants it, as it should have been linked into 
>> apr-1.dll already - maybe someone else can chime in.
> 
> You must mean libapr-1.lib/libapr-1.dll, yes, it is.
> 
> But no, it's not linked to apr-1.lib (static).

Good point - I missed that.  Now the original email makes more sense.

Re: Newbie question: Compiling helloworld-APR.c under Windows

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Issac Goldstand wrote:
> Sounds like the liker wants Winsock linked in (ws2_32.lib).  Not sure 
> why your application wants it, as it should have been linked into 
> apr-1.dll already - maybe someone else can chime in.

You must mean libapr-1.lib/libapr-1.dll, yes, it is.

But no, it's not linked to apr-1.lib (static).

I'm contemplating some trickery which would ensure that the user doesn't
have to call out dependent libs, but not till apr 1.3.0

Re: Newbie question: Compiling helloworld-APR.c under Windows

Posted by Issac Goldstand <ma...@beamartyr.net>.
Sounds like the liker wants Winsock linked in (ws2_32.lib).  Not sure 
why your application wants it, as it should have been linked into 
apr-1.dll already - maybe someone else can chime in.

   Issac

Joachim Ziegler wrote:
> Hello William,
> 
> thank you for your quick reply last week.
> 
> Unfortunately I still cannot get helloworld-APR.c running under Windows.
> 
> William A. Rowe, Jr. wrote:
>> If you used a -win32-src.zip file, and run nmake against the
>> makefile.win, you shouldn't be having problems.
> 
> I'm not quite sure to understand what you mean by this. Yes, I have 
> downloaded the win32-src.zip file and followed the instructions in the 
> section "Developer Studio Workspace/Microsoft Development Environment 
> IDE Build" on
> 
> http://apr.apache.org/compiling_win32.html
> 
> to build the libs.
> 
> I have also successfully built and run the apr/test/aprtest.dsw project.
> 
>>
>> If you import into VS2005/2008, there are dependency hassles,
>> but you can usually work those out by reviewing the build
>> target and it's dependencies.  APR alone is pretty easy.
> 
> Sorry, I do not understand what you say here. It might well be that I 
> just know too little about Windows programming in general. (I come from 
> a UNIX background.)
> 
>> Finally, apr.h defines those APR_DECLARE macros to be .dll
>> imports if you do nothing.  You do need to declare -D WIN32
>> of course.
> 
> I have found out by myself that I have to declare this WIN32 macro by 
> following the compiler's error messages into the apr.h file. You say "of 
> course": Is this something I should have known beforehand because it is 
> customary in Windows development? If not so: I cannot read anything 
> about this in the official documentation!?
> 
> Anyway, now my helloworld compiles, but it does not link. I get the 
> following error messages:
> 
> ------ Build started: Project: TestAPR, Configuration: Debug Win32 ------
> Linking...
> try-helloworld-APR.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' 
> due to '/OPT:ICF' specification
> apr-1.lib(start.obj) : error LNK2019: unresolved external symbol 
> __imp__WSACleanup@0 referenced in function _apr_initialize@0
> apr-1.lib(start.obj) : error LNK2019: unresolved external symbol 
> __imp__WSAStartup@8 referenced in function _apr_initialize@0
> apr-1.lib(apr_snprintf.obj) : error LNK2019: unresolved external symbol 
> __imp__ntohl@4 referenced in function _conv_in_addr
> apr-1.lib(sockaddr.obj) : error LNK2001: unresolved external symbol 
> __imp__ntohl@4
> apr-1.lib(sockaddr.obj) : error LNK2019: unresolved external symbol 
> __imp__htons@4 referenced in function _apr_sockaddr_vars_set
> apr-1.lib(sockaddr.obj) : error LNK2019: unresolved external symbol 
> __imp__ntohs@4 referenced in function _get_local_addr
> apr-1.lib(sockaddr.obj) : error LNK2019: unresolved external symbol 
> __imp__WSAGetLastError@0 referenced in function _get_local_addr
> [...]
> 
> Can someone please help me?
> 
> Thank you very much,
> Joachim