Bonjour à tous,
J'essaye de compiler avec Mingw un exemple d'utilisation de la librairie log4cxx trouvé sur le net. La compilation semble bien se passer mais j'ai des erreurs au link.
La dll log4cxx est compilée avec Visual C++ (Bibliothèque dynamique (.dll)).

Voici le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdlib.h>
// include log4cxx header files.
#include "log4cxx/logger.h"
#include "log4cxx/basicconfigurator.h"
#include "log4cxx/propertyconfigurator.h"
#include "log4cxx/helpers/exception.h"
 
using namespace log4cxx;
using namespace log4cxx::helpers;
LoggerPtr logger(Logger::getLogger("Main"));
 
int main(int argc, char** argv) {
 
 
    try {
        if (argc == 0) {
            BasicConfigurator::configure();
        } else {
            PropertyConfigurator::configure(argv[1]);
        }
 
        LOG4CXX_INFO(logger, "Ma première ligne de log avec log4cxx !");
    } catch (Exception&) {
        return EXIT_FAILURE;
    }
 
 
    return (EXIT_SUCCESS);
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
C:\testlog4cxx>g++ main.cpp -o test.exe -I"c:\testlog4cxx\log4cxx" -L"c:\testlog
4cxx\log4cxx\lib" 
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x167): undefined
reference to `_imp___ZN7log4cxx17BasicConfigurator9configureEv'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x18c): undefined
reference to `_imp___ZN7log4cxx4FileC1EPKc'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x1a0): undefined
reference to `_imp___ZN7log4cxx20PropertyConfigurator9configureERKNS_4FileE'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x1ce): undefined
reference to `_imp___ZN7log4cxx4FileD1Ev'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x1ff): undefined
reference to `_imp___ZN7log4cxx4FileD1Ev'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x223): undefined
reference to `_imp___ZNK7log4cxx6Logger13isInfoEnabledEv'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x238): undefined
reference to `_imp___ZN7log4cxx7helpers13MessageBufferC1Ev'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x25d): undefined
reference to `_imp___ZN7log4cxx3spi12LocationInfoC1EPKcS3_i'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x282): undefined
reference to `_imp___ZN7log4cxx7helpers13MessageBufferlsEPKc'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x293): undefined
reference to `_imp___ZN7log4cxx7helpers13MessageBuffer3strERNS0_17CharMessageBuf
ferE'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x2a6): undefined
reference to `_imp___ZN7log4cxx5Level7getInfoEv'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x2ed): undefined
reference to `_imp___ZNK7log4cxx6Logger9forcedLogERKNS_7helpers10ObjectPtrTINS_5
LevelEEERKSsRKNS_3spi12LocationInfoE'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x3b0): undefined
reference to `_imp___ZN7log4cxx7helpers13MessageBufferD1Ev'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x3de): undefined
reference to `_imp___ZN7log4cxx7helpers13MessageBufferD1Ev'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text+0x476): undefined
reference to `_imp___ZN7log4cxx6Logger9getLoggerEPKc'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text$_ZN7log4cxx7helper
s10ObjectPtrTINS_5LevelEED1Ev[log4cxx::helpers::ObjectPtrT<log4cxx::Level>::~Obj
ectPtrT()]+0x7e): undefined reference to `_imp___ZN7log4cxx7helpers13ObjectPtrBa
seD2Ev'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text$_ZN7log4cxx7helper
s10ObjectPtrTINS_5LevelEED1Ev[log4cxx::helpers::ObjectPtrT<log4cxx::Level>::~Obj
ectPtrT()]+0xaa): undefined reference to `_imp___ZN7log4cxx7helpers13ObjectPtrBa
seD2Ev'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text$_ZN7log4cxx7helper
s10ObjectPtrTINS_6LoggerEED1Ev[log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~O
bjectPtrT()]+0x7e): undefined reference to `_imp___ZN7log4cxx7helpers13ObjectPtr
BaseD2Ev'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text$_ZN7log4cxx7helper
s10ObjectPtrTINS_6LoggerEED1Ev[log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~O
bjectPtrT()]+0xaa): undefined reference to `_imp___ZN7log4cxx7helpers13ObjectPtr
BaseD2Ev'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text$_ZN7log4cxx7helper
s10ObjectPtrTINS_5LevelEED0Ev[log4cxx::helpers::ObjectPtrT<log4cxx::Level>::~Obj
ectPtrT()]+0x7e): undefined reference to `_imp___ZN7log4cxx7helpers13ObjectPtrBa
seD2Ev'
C:\DOCUME~1\USER~1\LOCALS~1\Temp/ccNKZbvF.o:main.cpp:(.text$_ZN7log4cxx7helper
s10ObjectPtrTINS_5LevelEED0Ev[log4cxx::helpers::ObjectPtrT<log4cxx::Level>::~Obj
ectPtrT()]+0xaa): more undefined references to `_imp___ZN7log4cxx7helpers13Objec
tPtrBaseD2Ev' follow
collect2: ld returned 1 exit status

Pourriez-vous m'aider à trouver ce que je ne fais correctement?
Merci d'avance.