multiple definition of `vsnprintf'
Matt Brown <[email protected]>
| Newsgroups | gmane.comp.gnu.mingw.user |
|---|---|
| Message-ID | <DB6P190MB0085D5E8ABBCE3F614E0CB2FB7DA0@DB6P190MB0085.EURP190.PROD.OUTLOOK.COM> |
Hi,
I've just used mingw-get to upgrade my mingw installation. I believe I've upgraded from "g++ (MinGW.org GCC-8.2.0-3) 8.2.0" to "g++ (MinGW.org GCC-8.2.0-4) 8.2.0".
This upgrade has appeared to cause the link to start failing because of a multiple definition of 'vnsprintf'.
I reproduced the problem with the follow code snippet:
#include <stdio.h>
#include <stdarg.h>
void debug_log(const char *fmt, ...) {
va_list args1;
va_start(args1, fmt);
va_list args2;
va_copy(args2, args1);
char buf[1+vsnprintf(NULL, 0, fmt, args1)];
va_end(args1);
vsnprintf(buf, sizeof buf, fmt, args2);
va_end(args2);
}
main() {
printf("mingw-link\n");
}
Here's the output:
C:\...\mingw-link>g++ -o mingw-link.exe main.cpp
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../libmingwex.a(vsnprintf.o):(.text+0x0): multiple definition of `vsnprintf'; C:\...\AppData\Local\Temp\cckc8wEp.o:main.cpp:(.text$vsnprintf[_vsnprintf]+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
I attempted to return the previous version of mingw with:
mingw-get upgrade gcc=8.2.0-3
While mingw-get did do something it didn't fix the problem.
I believe the same thing happens with a fresh installation on a PC that hasn't mingw before.
I also pasted the code snippet into www.onlinegdb.com and it seemed happy with it.
Any thoughts greatly appreciated,
Matt
_______________________________________________
MinGW-Users mailing list
[email protected]
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.osdn.me/mailman/listinfo/mingw-users
Also: mailto:[email protected]?subject=unsubscribe