Hello,
I'm try to build the Common-C++ libs using MinGW and
MSYS on Microsoft Windows. The configure script
seems to work well but when make with the
w32/Makefile.gcc I got these errors:
$ make -f Makefile.gcc
/mingw/bin/c++ -c -I. -I../include -I/mingw/include/libxml -
DHAVE_CONFIG_H -D_GNU_SOURCE -
include ../w32/cc++/config.h -g -O2 -mthreads -
o ../w32/../w32/thread.o ../src/thread.cpp
In file included from C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/mingw32/bits/c++locale.h:43,
from C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/iosfwd:46,
from C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/bits/stl_algobase.h:70,
from C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/bits/char_traits.h:46,
from C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/string:47,
from ../include/cc++/strchar.h:50,
from ../include/cc++/missing.h:46,
from ../include/cc++/string.h:47,
from ../include/cc++/exception.h:51,
from ../src/thread.cpp:41:
C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/cstdio:167: error: `::snprintf' has not been declared
C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/cstdio:177: error: `__gnu_cxx::snprintf' has not been
declared
In file included from C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/iosfwd:46,
from C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/bits/stl_algobase.h:70,
from C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/bits/char_traits.h:46,
from C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/string:47,
from ../include/cc++/strchar.h:50,
from ../include/cc++/missing.h:46,
from ../include/cc++/string.h:47,
from ../include/cc++/exception.h:51,
from ../src/thread.cpp:41:
C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/mingw32/bits/c++locale.h: In function `int
std::__convert_from_v(char*, int, const char*, _Tv, int*
const&, int)':
C:/programmi/Dev-
Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/mingw32/bits/c++locale.h:68: error: `snprintf' is not a
member of `std'
../src/thread.cpp: In member function `void
ost::Thread::setName(const char*)':
../src/thread.cpp:761: error: `snprintf' undeclared (first
use this function)
../src/thread.cpp:761: error: (Each undeclared identifier
is reported only once for each function it appears in.)
../src/thread.cpp: In static member function `static
unsigned int ost::Thread::Execute(ost::Thread*)':
../src/thread.cpp:1464: error: `snprintf' undeclared (first
use this function)
make: *** [../w32/thread.o] Error 1
This seems to be some kind of define or configuration
missing parameter. Can you help me, please?
Thank you.
Logged In: YES
user_id=217
It has been a long time since I tried mingw32...snprintf may be defined in
cstdio/stdio.h, or maybe in another header? The other option is that you may
be able to -Dsnprintf=_snprintf since the w32 c runtime library uses _snprintf
instead of snprintf.
Logged In: NO
Adding -Dsnprinf=_snprinf in the CPPFLAGS define within the
w32/Makefile.gcc doesn't change the result. The snprinf
seems to be defined within the cstdio header file but I'm not
sure.
Logged In: NO
Solved!
Add -D_snprintf=snprintf (NOT -Dsnprintf=_snprintf) to the
CPPFLAGS declaration in w32/Makefile.gcc
Now I got another frustrating error:
g++ -DHAVE_CONFIG_H -I. -I. -I../include -I../src -
DCCXX_EXPORT_LIBRARY -D_GNU_SOURCE -I../w32 -g -O2 -MT
file.lo -MD -MP -MF .deps/file.Tpo -c file.cpp -
DDLL_EXPORT -DPIC -o .libs/file.o
file.cpp: In function `time_t ost::lastAccessed(const
char*)':
file.cpp:1455: error: `SECS_BETWEEN_EPOCHS' undeclared
(first use this function)
file.cpp:1455: error: (Each undeclared identifier is
reported only once for each function it appears in.)
file.cpp:1455: error: `SECS_TO_100NS' undeclared (first use
this function)
file.cpp: In function `time_t ost::lastModified(const
char*)':
file.cpp:1481: error: `SECS_BETWEEN_EPOCHS' undeclared
(first use this function)
file.cpp:1481: error: `SECS_TO_100NS' undeclared (first use
this function)
make[1]: *** [file.lo] Error 1
make[1]: Leaving directory `/home/sferra/commoncpp2-
1.3.21/src'
make: *** [all-recursive] Error 1
Please, help me! :)
Logged In: YES
user_id=217
Originator: NO
This is now fixed, and works rather well at least on gnu/linux hosted mingw32 cross compilers.