[MinGW-Notify] [mingw] #39757: Compilation with GNU-C++ creates multiple definitions of vsnprintf()

Back to archive index
MinGW Notification List mingw****@lists*****
Fri Nov 15 22:26:30 JST 2019


#39757: Compilation with GNU-C++ creates multiple definitions of vsnprintf()



  Open Date: 2019-11-13 14:00
Last Update: 2019-11-15 13:26

URL for this Ticket:
    https://osdn.net//projects/mingw/ticket/39757
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39757

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2019-11-15 13:26 Updated by: keith
 * Status Update from Open to Closed

 * Resolution Update from None to Fixed


Comment:

I applied the proposed patch, and committed it as changeset id.3c7767e. This
will be included in the next WSL release.



---------------------------------------------------------------------
Ticket Status:

      Reporter: keith
         Owner: keith
          Type: Issues
        Status: Closed
      Priority: 7
     MileStone: (None)
     Component: WSL
      Severity: 8
    Resolution: Fixed
---------------------------------------------------------------------

Ticket details:

As reported in this pair of e-mail threads:

  • https://osdn.net/projects/mingw/lists/archive/users/2019-August/000333.htmlhttps://osdn.net/projects/mingw/lists/archive/users/2019-August/000335.html

compilation of any C++ translation unit which refers, either directly or
indirectly, to vsnprintf(), will result in link failure, due to multiple public
definitions of this symbol. The issue is clearly illustrated by the following
code, (abstracted from the latter e-mail report):

 1.  #include <stdio.h>
 2.  #include <stdarg.h>
 3.  
 4.  void debug_log(const char *fmt, ...) {
 5.      va_list args;
 6.      va_start(args, fmt);
 7.      char buf[1+vsnprintf(NULL, 0, fmt, args)];
 8.      vsnprintf(buf, sizeof buf, fmt, args);
 9.      va_end(args);
10.  }
11.  
12.  main() {
13.      printf("mingw-link\n");
14.  }

compilation of which yields:

$ 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';
main.cpp:(.text$vsnprintf[_vsnprintf]+0x0): first defined here
collect2.exe: error: ld returned 1 exit status



-- 
Ticket information of MinGW - Minimalist GNU for Windows project
MinGW - Minimalist GNU for Windows Project is hosted on OSDN

Project URL: https://osdn.net/projects/mingw/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/mingw/ticket/39757
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39757



More information about the MinGW-Notify mailing list
Back to archive index