이 Calculator.ada
파일을 gcc -c Calculator.ada
을 사용하여 컴파일하려고하는데 오류가 발생했습니다. warning: Calculator.ada: linker input file unused because linking not done
- 해결책을 찾고 해결책을 찾지 못했지만이를 컴파일 할 수는 있지만 생각지 못했습니다. 아직 밖으로 ....Ada - GCC를 사용하여 Ada 컴파일
여기 Calculator.ada
입니다 :
--
-- Integer calculator program. Takes lines of input consisting of
-- <operator> <number>, and applies each one to a display value. The
-- display value is printed at each step. The operator is one of =,
-- +, -, *, /, or ^, which correspond to assign, add, subtract, multiply
-- divide, and raise, respectively. The display value is initially zero.
-- The program terminates on a input of q.
--
with Text_IO;
with Gnat.Io; use Gnat.Io;
procedure Calc is
Op: Character; -- Operation to perform.
Disp: Integer := 0; -- Contents of the display.
In_Val: Integer; -- Input value used to update the display.
begin
loop
-- Print the display.
Put(Disp);
New_Line;
-- Promt the user.
Put("> ");
-- Skip leading blanks and read the operation.
loop
Get(Op);
exit when Op /= ' ';
end loop;
-- Stop when we're s'posed to.
exit when Op = 'Q' or Op = 'q';
-- Read the integer value (skips leading blanks) and discard the
-- remainder of the line.
Get(In_Val);
Text_IO.Skip_Line;
-- Apply the correct operation.
case Op is
when '=' => Disp := In_Val;
when '+' => Disp := Disp + In_Val;
when '-' => Disp := Disp - In_Val;
when '*' => Disp := Disp * In_Val;
when '/' => Disp := Disp/In_Val;
when '^' => Disp := Disp ** In_Val;
when '0'..'9' => Put_Line("Please specify an operation.");
when others => Put_Line("What is " & Op & "?");
end case;
end loop;
end Calc;
은 내가이 컴파일 할 수없는 이유에 어떤 도움을 부탁드립니다. 나는 gcc -c
으로 C 파일을 잘 컴파일 할 수 있었고 Ada와 같은 방법으로 컴파일 할 수 있다는 것을 읽었다.
컴파일되지 않았거나 @EugeneSh가 누락되었습니다. ? 나는 .asa 만 가지고 있고 거기에는/o. – NikkiNelson
[this] (https://gcc.gnu.org/onlinedocs/gnat_ugn/Running-a-Simple-Ada-Program.html)에서 ADA 프로그램의 확장자는'adb' 또는'ads'이어야합니다. 'gcc'는 ADA 프로그램이라고 이해하지 못할 수도 있습니다 ... –
"gnat --version"... "명령을 찾을 수 없습니다"라는 메시지가 나타나면 gcc 설치가 불완전해질 수 있습니다. (일반적으로 "gnat-"이라는 패키지를 찾아서 설치하십시오. "gnatmake Calculator.adb"(파일의 이름을 바꿉니다!)를 컴파일하고 링크해야합니다. –