c++ 컴파일 되지 않음


  • Level 2

    잘 쓰고 있던 컨테이너에서 오늘 새롭게 컴파일을 해 봤더니
    mkdir -p /workspace/BOJ/bin/ && gcc $(find /workspace/BOJ/src/ -name .cpp -o -name .c) -o /workspace/BOJ/bin//main -g -lm
    /workspace/BOJ/src/1297.cpp:8: undefined reference to std::cin'base::sync_with_stdio(bool)' /workspace/BOJ/src/1297.cpp:8: undefined reference tostd::cin'base::sync_with_stdio(bool)'
    /workspace/BOJ/src/1297.cpp:8: undefined reference to std::cin'base::sync_with_stdio(bool)' /workspace/BOJ/src/1297.cpp:8: undefined reference tostd::basic_ios<char, std::char_traits<char> >::tie(std::ostream
    )'
    /workspace/BOJ/src/1297.cpp:9: undefined reference to std::cout' /workspace/BOJ/src/1297.cpp:9: undefined reference tostd::basic_ios<char, std::char_traits<char> >::tie(std::ostream
    )'
    /workspace/BOJ/src/1297.cpp:11: undefined reference to std::cin' /workspace/BOJ/src/1297.cpp:11: undefined reference tostd::istream::operator>>(double&)'
    /workspace/BOJ/src/1297.cpp:11: undefined reference to std::istream::operator>>(double&)' /workspace/BOJ/src/1297.cpp:11: undefined reference tostd::istream::operator>>(double&)'
    /workspace/BOJ/src/1297.cpp:18: undefined reference to std::cout' /workspace/BOJ/src/1297.cpp:18: undefined reference tostd::ostream::operator<<(double)'
    /workspace/BOJ/src/1297.cpp:18: undefined reference to std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' /workspace/BOJ/src/1297.cpp:18: undefined reference tostd::ostream::operator<<(double)'
    /tmp/ccP4J3VE.o: In function __static_initialization_and_destruction_0(int, int)': /usr/include/c++/9/iostream:74: undefined reference tostd::ios_base::Init::Init()'
    /usr/include/c++/9/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
    collect2: error: ld returned 1 exit status

    와 같은 오류가 납니다.
    같은 코드를 새롭게 컨테이너를 만들어서 실행해보면 문제가 없습니다.
    왜 이렇게 되는지 알고싶습니다.

  • Level 8

    @홍유찬 std=c++17 컴파일 플래그를 추가해보셨나요?

SUGGESTED TOPICS