Show: Delphi C++
Display Preferences

Linking a C++ 64-bit Windows Hello World Application

From RAD Studio XE3
Jump to: navigation, search

Go Up to ILINK64.EXE,_the_64-bit_Incremental_Linker


Contents

Application code

 
//hello.cpp 
#include<iostream> 
#include<string> 
int main(int, char**) 
{ 
  std::string s("Hello world"); 
  std::cout<<s; 
  return 0; 
}

Compiling

You can compile this source using:

> "c:\program files (x86)\embarcadero\rad studio\10.0\bin\bcc64.exe" -cc1 -D _RTLDLL -isystem "c:\program files (x86)\embarcadero\rad studio\10.0\include" -isystem "c:\program files (x86)\embarcadero\rad studio\10.0\include\dinkumware" -isystem "c:\program files (x86)\embarcadero\rad studio\10.0\include\windows\crtl" -fborland-extensions -triple=x86_64-pc-win32-elf -emit-obj -std=c++11 -o Hello.o 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\rad studio\10.0\bin\ilink64" -j"c:\program files (x86)\embarcadero\rad studio\10.0\lib\win64\release" -Gn c0x64 Hello.o , Hello.exe , Hello.map , import64.a cw64mti.a , ,  

Now run Hello.exe, and "Hello world" prints on the screen.

See Also

Personal tools
Previous Versions
In other languages