Notice
Recent Posts
Recent Comments
Link
취미생활
[C++] 에러 해결 ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} 본문
컴퓨터/에러 해결
[C++] 에러 해결 ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}
달다달아 2022. 11. 5. 03:07해당 에러는 printf format 에 std::string 문자를 입력해서 나오는 에러다.
printf는 c 기반이고 std::string 는 c++ 기반이라 호환을 하지 않는다.
그러므로 다음과 같이 써주자.
printf("%s\n", str.c_str());
'컴퓨터 > 에러 해결' 카테고리의 다른 글
라즈베리파이 youtube-dl Unable to extract uploader id 문제 해결 (1) | 2023.10.15 |
---|---|
[Vim] Replace가 자동으로 실행될 때 해결법 (0) | 2022.11.05 |
[Vscode Python] FileNotFoundError: No such file or directory 에러 해결 (0) | 2021.04.29 |
[VSCode] 새로설치한 Python Module이 Import가 안된다면 확인해볼 사항 (1) | 2021.03.26 |
Comments