Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC compilation option "-fexec-charset=utf-8" has a serious problem. #23072

Open
4 of 6 tasks
MaxLHy0424 opened this issue Jan 10, 2025 · 2 comments
Open
4 of 6 tasks

Comments

@MaxLHy0424
Copy link

MaxLHy0424 commented Jan 10, 2025

Description / Steps to reproduce the issue

  1. Create a C++ source code file that includes the <print> header file, for example:
#include <print>
auto main() -> int
{
    std::print( "Test\n" );
    return 0;
}
  1. In the compilation options, add the option -fexec-charset=utf-8, and then compile the source code file created in the previous step.

Expected behavior

The source code file has been successfully compiled and linked.

Actual behavior

GCC will return the following link error messages:

C:/Software/MSYS2/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\MaxLH\AppData\Local\Temp\cchGzAWv.o:main.cpp:(.text$_ZSt14vprint_unicodeP6_iobufSt17basic_string_viewIcSt11char_traitsIcEESt17basic_format_argsISt20basic_format_contextINSt8__format10_Sink_iterIcEEcEE[_ZSt14vprint_unicodeP6_iobufSt17basic_string_viewIcSt11char_traitsIcEESt17basic_format_argsISt20basic_format_contextINSt8__format10_Sink_iterIcEEcEE]+0x24d): undefined reference to `std::__write_to_terminal(void*, std::span<char, 18446744073709551615ull>)'
collect2.exe: error: ld returned 1 exit status

Verification

Windows Version

MSYS_NT-10.0-27768

MINGW environments affected

  • MINGW64
  • MINGW32
  • UCRT64
  • CLANG64
  • CLANGARM64

Are you willing to submit a PR?

No.

@MaxLHy0424 MaxLHy0424 added the bug label Jan 10, 2025
@Biswa96 Biswa96 added the GCC label Jan 10, 2025
@nak5124
Copy link
Contributor

nak5124 commented Jan 20, 2025

On Mingw, you should add -lstdc++exp.
I don't know if this is a bug or not.

@MaxLHy0424
Copy link
Author

On Mingw, you should add -lstdc++exp. I don't know if this is a bug or not.

Oh, thanks. It has been works. I think this should have been mentioned in the document. I hope this can be added to the document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants