2013-06-27 2 views
-2

내 프로그램 용 make 파일을 만들고 있습니다. 기본 설정 : twitServer.cpp 및 그 사용 : Command.h Client.hC++ 프로그램 컴파일 및 링크 - 파일 만들기

make 파일을 만들었지 만 작동하지 않습니다. 알아낼 수 있습니까?

twitServer: twitServer.o Command.o Client.o 
    g++ -Wall -o twitServer.o Command.o Client.o twitServer 

twitServer.o: twitServer.cpp Command.h Client.h 
    g++ -c -Wall twitServer.cpp 

Command.o: Command.cpp Command.h 
    g++ -c -Wall Command.cpp 

Client.o: Client.cpp Client.h 
    g++ -c -Wall Client.cpp 

clean: 
    rm twitServer Client.o Command.o Client.o 

내 오류는 다음과 같습니다 g ++ : twitServer : 그런 파일이 없습니다 아니면이 모든 파일을 가지고 있지만

디렉토리 : Client.cpp Client.o Command.h 메이크 twitServer.cpp Client.h을 Command.cpp Command.o 메이크 ~ twitServer.o

+0

'작동하지 않는 것 같습니다.'에 대해 자세히 설명해주십시오. 오류가 있습니까? –

+0

명령 시작시 TAB 특수 문자를 사용하고 있습니까? (g ++ 이전). 그 makefile을 실행하려고 할 때 나타나는 오류 메시지는 무엇입니까? – ondrejdee

+0

다음은 오류입니다. g ++ : twitServer : 해당 파일이나 디렉토리가 없습니다. –

답변

1

여기 :

g++ -Wall -o twitServer.o Command.o Client.o twitServer 

이 잘못되었습니다. 컴파일러에서 twitServer.o을 출력하지 않으려면 twitServer 파일을 연결 하시겠습니까? 이 두 가지는 뒤집어 져야합니다.

g++ -Wall -o twitServer Command.o Client.o twitServer.o 
+0

고마워요.하지만 지금은 수정 한 후 프로그램을 실행하려고합니다 : twitServer : 명령을 찾을 수 없습니다. –

+0

@fgfjhgrjrerjhm 읽기 다른 대답에 대한 내 의견이나 여기에서 반복해야합니까? –

1

변경 -o 플래그의 위치 :

twitServer: twitServer.o Command.o Client.o 
    g++ -Wall twitServer.o Command.o Client.o -o twitServer 
+0

고마워요. twitServer : 명령을 찾을 수 없습니다. 프로그램을 실행하는 중입니다. –

+2

@fgfjhgrjrerjhm './twitServer' –

+0

왜 그런가요? 그것없이 어떻게 달릴 수 있습니까? /? –

관련 문제