Linking a C++ Hello World Application

From RAD Studio
Jump to: navigation, search

Go Up to Using ILINK32 and ILINK64 on the Command Line


Application code

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

You can compile this using:

> bcc32 -c hello.cpp

After this step, you need to link the .obj files and the .lib files into the executable:

> ilink32 hello.obj c0x32.obj,hello.exe,,import32.lib cw32.lib,,

After this, the hello.exe executable is linked, and, if you run it, then you will see "hello world" printed on screen.

See Also

Static Run-time Libraries