Linking a C++ 64-bit Windows Hello World Application
Go Up to Using ILINK32 and ILINK64 on the Command Line
Contents
Application code
// hello.cpp
#include<iostream>
#include<string>
int main()
{
std::string s("Hello world");
std::cout << s;
}
Compiling
You can compile this source using:
>"C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\bcc64.exe" -c hello.cpp
This command creates the Object(.0
) file needed for linking.
Linking
Then link the .a
and .o
files, and create the 64-bit Windows executable file for the HelloWorld App using the following command:
> "C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ilink64" -j"C:\Program Files (x86)\Embarcadero\Studio\22.0lib\win64\release" -Gn c0x64 Hello.o, Hello.exe, Hello.map, import64.a cw64mt.a, ,
You can also let the compiler invoke the linker, using the following command:
> "C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\bcc64.exe" hello.o
Now run Hello.exe, and "Hello world" prints on the screen.