Most computer languages in their pure sense are cross-platform - as a high-level, human readable way to instruct a CPU there is no need to strongly depend on any particular operating system. However, to do things such as create a GUI using the system widget set a program links to libraries, which may be particular to the developer's system. Although C++ itself is cross platform, a program written in for Windows using the Win32 API would normally not compile on a Unix computer. There are often also differences in how compiler writers interpret a language specification, in this case a program may require some attention before it be built on multiple systems.
Some programming languages such as Java were designed from the start to work on any platform that has a suitable virtual machine. Languages which use bytecode as the compiled representation, or which interpret scripts directly do not need to be compiled for any particular operating system. Native libraries of the operating system are not linked to by the distributed code, rather the run time environment reimplements much of the same functionality, or provides a common bridge to similar functions on different systems. It is possible to create Java programs which only run on a particular system, either by using JNI or by running a bytecode-to-machinecode compiler; this is not necessary for most tasks.
Providing and testing compiled versions of a program for every OS and CPU is practically impossible, so projects which are Open Source or otherwise allow the user to compile their own object code could be said to be more cross-platform. Likewise, languages which are interpreted or otherwise require a virtual machine, are more cross-platform where individuals can compile their own. Hotspot, Sun's Java virtual machine is provided only as compiled binaries, with support for several, but not all, platforms. For example, Sun only support GNU/Linux on the i386 architecture - anyone running Linux on PowerPC or SPARC computers cannot use Java without compiling to native machinecode or using third party tools.
Many APIs are platform specific. OpenGL can be said to be cross-platform because it is not tied to any particular operating system, CPU architecture or brand of graphics hardware. Platform specific APIs may be recreated on other systems as a compatibility layer, such as the WINE library which allows programs requiring windows libraries to be used on UNIX.
There are also cross-platform extensions and middleware for many programming languages that enable programmers to compile/run the same source code with minimal fixes on different platforms. An example is wxWidgets.
Cross-platform and the Web
Web applications are normally usable from any platform with a web browser, regardless of the language they are written in. This is because the code is run on a server and comunication with the user agent is done only through http and (X)HTML.
Web pages are sometimes said to be cross-platform or cross-browser if they can be used from any browser, or any recent browser. As well as the author producing valid code, this often requires a working knowledge of the quirks loosely-conforming browsers, such as Internet Explorer, exhibit in their interpretation of web standards.
A web page containing content not renderable by all browsers such as Macromedia Flash presentations may still be cross platform if allowances are made for people without the special plugins. For example, images to be shown in place of rich content or a downloadable MPEG-2 version of animated material.
Cross-platform web accessibility requires as much an undertanding of users as of technical standards, if a page is to be accessible on platforms as varied as screen readers, Braile-based web browsers, and small devices like mobile phones and PDAs.