Compiling APR + LOG4CXX libraries

Hello!
I'm starting to study again this wonderful programming language while being a Java Backend Developer.

I was creating a simple c++ project and had the idea to introduce some solid logging library in order for me to have log files (like log4j in Java).

I would create this from scratch but I want to know how to compile external libraries'source code.

The library i'm focused on is "log4cxx", which depends on Apache Portable Runtime.

Before starting:
1. I'm compiling on Windows 10 with Visual studio.
2. I don't know anything about CMake, by now.
3. I do not want pre compiled libraries because I want to learn how to compile them.

By following this guide: https://apr.apache.org/compiling_win32.html
I am getting C2513 errors by visual studio.

I know this is not a question strictly related to C++ programming, but using external libraries is a common practice regardless the programming language being used.

If nothing helps, i would appreciate the simple steps to do in order to compile a generic library, which in turn may depend on other libraries too.

I really hope this is not a "silly" post, thanks for your help!
Last edited on
its not silly, but you need to follow the instructions given by the guide.

No one set of instructions will do it: unfortunately large libraries are complex things with complicated and unique instructions for each one.

To learn more about, I suggest you actually WRITE a small library as the first step. This may seem counterintuitive, but all you need is a set of say string functions that say "you called method 1" or "you called method 2" etc -- 4 or 5 of those kinds of things, bundle it up into a library, and call it in a new program. Get that down, then do it again with a dynamic library (dll). Once you have those two, at least the raw basic stuff will not get in your way. You can find examples online if you want to take a few hours off on a side project to play with the basic library stuff.

error 2513 can be caused by improper (outdated?) use of a typedef. Is this library very old, and are you using visual studio 2019? Your instructions say compiling in WIN32. My last 4 or 5 computers have been 64 bit and I run them until they die... 32 bit was long ago. Your instructions have.. somewhat scary references to 2002, 2003, and 2005. This code, if it were a person, is almost old enough to vote. I am out of time tonight but look to see if there is an updated version of this thing that is 64 bit and 2017 or newer.
Last edited on
Hello Jonnin, thanks for you help!

I agree with you on the fact that this library may be outdated by now, and i'm just having problems because the library itself has some kind of issues when compiling on new systems/compilers.

I thought that win32 was just a synonimous for Windows x86_x64.

Maybe I just have to give up on this library and find another one...
Oooof! Those instructions are seriously outdated. Use Visual Studio 6.0?!?

A lot of the Win32 API changed over the years, along with the C/C++ standards.

I thought that win32 was just a synonimous for Windows x86_x64.

x64 Windows programming has different/new data types compared to x86.

https://docs.microsoft.com/en-us/windows/win32/winprog64/the-new-data-types

If you don't have a lot of experience converting older libraries/source code to the new standards the process can be highly frustrating and close to impossible.

Great learning experience, though.
Last edited on
Topic archived. No new replies allowed.