Free Pascal の入手 |
---|
Free Pascal Win32 & Win64 のインストール |
---|
Free PascalのPATHの設定 |
---|
@ECHO OFF REM REM Free Pascal 環境変数設定。 REM CALL resetpath.cmd PATH C:\FPC\3.2.2\bin\i386-Win32;%PATH%
Microsoft Windows [Version 10.0.22631.3958]
(c) Microsoft Corporation. All rights reserved.
C:\PG>fpc
Free Pascal Compiler version 3.2.2 [2021/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
C:\FPC\3.2.2\bin\i386-win32\fpc.exe [options] <inputfile> [options]
Only options valid for the default or selected platform are listed.
Put + after a boolean switch option to enable it, - to disable it.
@<x> Read compiler options from <x> in addition to the default fpc.cfg
-a The compiler does not delete the generated assembler file
-a5 Don't generate Big Obj COFF files for GNU Binutils older than 2.25 (Windows, NativeNT)
-al List sourcecode lines in assembler file
-an List node info in assembler file (-dEXTDEBUG compiler)
-ao Add an extra option to external assembler call (ignored for internal)
-ar List register allocation/release info in assembler file
-at List temp allocation/release info in assembler file
-A<x> Output format:
-Adefault Use default assembler
-Aas Assemble using GNU AS
-Amacho Mach-O (Darwin, Intel 32 bit) using internal writer
-Anasm Assemble using Nasm
-Anasmcoff COFF (Go32v2) file using Nasm
*** press enter ***
Free PascalのHollo, world. (その1) |
---|
{ Free PascalのHello, world.(日本語版) } program Hello; {$MODE OBJFPC}{$H+} {$CODEPAGE UTF8} uses SysUtils; begin WriteLn(Output, '世界よ、こんにちは。') end.
C:\PG>CD FreePascal\Hello
C:\PG\FreePascal\Hello>fpc -Twin32 -Pi386 Hello.pas
Free Pascal Compiler version 3.2.2 [2021/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling Hello.pp
Linking Hello.exe
14 lines compiled, 0.1 sec, 68240 bytes code, 4260 bytes data
C:\PG\FreePascal\Hello>Hello
世界よ、こんにちは。
C:\PG\FreePascal\Hello>
C:\PG\FreePascal\Hello>fpc -Twin64 -Px86_64 Hello.pas
Free Pascal Compiler version 3.2.2 [2021/05/15] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling Hello.pas
Linking Hello.exe
14 lines compiled, 0.2 sec, 72688 bytes code, 5252 bytes data
C:\PG\FreePascal\Hello>Hello
世界よ、こんにちは。
C:\PG\FreePascal\Hello>
Free PascalのHollo, world. (その2) |
---|
{=============================================================================} {= プログラム:Hello2 =} {=============================================================================} program Hello2; {$MODE OBJFPC}{$H+} {$CODEPAGE UTF8} uses SysUtils, SayHelloUnit; { SayHelloUnit の利用 } begin SayHelloEng(Output); { SayHelloUnit の SayHelloEng の呼び出し } SayHelloJpn(Output); { SayHelloUnit の SayHelloJpn の呼び出し } end.
{=============================================================================} {= ユニット:SayHelloUnit =} {=============================================================================} unit SayHelloUnit; {$MODE OBJFPC}{$H+} {$CODEPAGE UTF8} {=============================================================================} {= 【インターフェース部】 =} {=============================================================================} interface uses SysUtils; procedure SayHelloEng(var F : Text); procedure SayHelloGmn(var F : Text); procedure SayHelloJpn(var F : Text); {=============================================================================} {= 【実現部】 =} {=============================================================================} implementation { 英語 } procedure SayHelloEng(var F : Text); begin WriteLn(F, 'Hello, World.'); end; { ドイツ語 } procedure SayHelloGmn(var F : Text); begin WriteLn(F, 'Hallo, Welt.'); end; { 日本語 } procedure SayHelloJpn(var F : Text); begin WriteLn(F, '世界よ、こんにちは。'); end; end.
# # Hello2 の メイクファイル # MAIN = Hello2 UNIT1 = SayHelloUnit # Target Win32 FPCFLAGS = -Twin32 -Pi386 # Target Win64 #FPCFLAGS = -Twin64 -Px86_64 $(MAIN).exe : $(MAIN).pas $(UNIT1).ppu @rm -f $(MAIN).o fpc $(FPCFLAGS) -o$(MAIN).exe $(MAIN).pas $(UNIT1).ppu : $(UNIT1).pas @rm -f $(UNIT1).o $(UNIT1).ppu fpc $(FPCFLAGS) $(UNIT1).pas clean : rm -f $(MAIN).exe $(MAIN).o $(UNIT1).o $(UNIT1).ppu
C:\PG>CD FreePascal\Hello2
C:\PG\FreePascal\Hello2>make
fpc -Twin32 -Pi386 SayHelloUnit.pas
Free Pascal Compiler version 3.2.2 [2021/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling SayHelloUnit.pas
51 lines compiled, 0.0 sec
fpc -Twin32 -Pi386 -oHello2.exe Hello2.pas
Free Pascal Compiler version 3.2.2 [2021/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling Hello2.pas
Linking Hello2.exe
20 lines compiled, 0.1 sec, 68336 bytes code, 4260 bytes data
C:\PG\FreePascal\Hello2>Hello2
Hello, World.
世界よ、こんにちは。
C:\PG\FreePascal\Hello2>
C:\PG\FreePascal\Hello2>make clean
rm -f Hello2.exe Hello2.o SayHelloUnit.o SayHelloUnit.ppu
C:\PG\FreePascal\Hello2>
C:\PG\FreePascal\Hello2>fpc -Twin32 -Pi386 Hello2.pas
Free Pascal Compiler version 3.2.2 [2021/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling Hello2.pas
Compiling SayHelloUnit.pas
Linking Hello2.exe
71 lines compiled, 0.1 sec, 68336 bytes code, 4260 bytes data
C:\PG\FreePascal\Hello2>
C:\PG\FreePascal\Hello2>fpc -Twin32 -Pi386 -FuC:\PG\FreePascal\MyUnit Hello2.pas
Free Pascal Compiler version 3.2.2 [2021/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling Hello2.pas
Compiling C:\PG\FreePascal\MyUnit\SayHelloUnit.pas
Linking Hello2.exe
71 lines compiled, 0.1 sec, 68336 bytes code, 4260 bytes data
C:\PG\FreePascal\Hello2>
捕捉:Free Pascal付属のIDE - fp.exe |
---|
C:\PG\FreePascal\fp>CHCP 437
Active code page: 437
C:\PG\FreePascal\fp>fp