이 프로그램에 대한 오류 메시지를 .. 설명해주십시오것은
#include <iostream>
using namespace std;
class copyConst
{
private:
int someVal;
public:
copyConst(const copyConst &objParam)
{
someVal = objParam.someVal;
}
copyConst()
{
someVal = 9;
}
copyConst& operator=(const copyConst &objParam)
{
if (this == &objParam)
return *this;
someVal = objParam.someVal;
return *this;
}
};
int main(int argc, char **argv)
{
copyConst obj1;
copyConst obj2(obj1);
copyConst obj3 = obj1;
copyConst obj4;
obj4 = obj1;
return 0;
}
오류 메시지 :
GCC는 "" "제목"untitled.cpp -o -Wall (의 디렉토리 : /home/rwik/Documents) untitled.cpp : 'int main (int, char **)': untitled.cpp : 53 : 12 : 경고 : 변수 'obj3'이 설정되었지만 사용되지 않음 [ 혼란스런 변수] /tmp/ccUIyRPg.o : 기능 있음
__static_initialization_and_destruction_0(int, int)': untitled.cpp:(.text+0x8a): undefined reference to
std :: ios_base :: Init :: Init() 'untitled.cpp :(. text + 0x8f) : undefined `std :: ios_base :: Init :: ~ Init()'에 대한 참조 컴파일이 실패했습니다. collect2 : LD는g++
하지gcc
를 사용
이상한 downvote, 대답은 완전히 정확합니다! +1 보상합니다. – juanchopanza