--- a/GettingEmscriptenToWork.wiki Fri May 11 16:29:45 2012 +0000
+++ b/GettingEmscriptenToWork.wiki Fri May 11 16:40:21 2012 +0000
@@ -1,4 +1,5 @@
#summary One-sentence summary of this page.
+#labels emscripten
This page is a brief introduction of how to get emscripten to work.
@@ -43,24 +44,31 @@
(Assume that you are in the emscripten root directory, where you can see the 'emcc' file)
-1. *hello world*
+1. *Hello World*
+{{{
./emcc tests/hello_world.cpp
node a.out.js
+}}}
You should be able to see "hello world!" in the terminal
If you want to have it run in browsers, you can type this (as in official tutorial):
-./emcc tests/hello_world_sdl.cpp -o hello.html
-
-2. *get the glgears to work in browsers*
-
-./emcc tests/hello_world_gles.c -o hello_world_gles.html
+{{{
+./emcc tests/hello_world.cpp -o hello.html
+}}}
-llvm 3.1+ won't compile this demo. The reason is that this demo uses malloc which has to been compiled first from dlmalloc. However emscripten uses llvm-ld as the linker, which has been removed in llvm 3.1+, and the result is that you will encounter some strange error messages saying that "no such file or directory". If you got this message, check your llvm and clang version.
+2. *Get the glgears to work in browsers*
+{{{
+./emcc tests/hello_world_gles.c -o hello_world_gles.html
+}}}
-3. *get the file system to work*
+llvm 3.2+ won't compile this demo. The reason is that this demo uses malloc which has to been compiled first from dlmalloc. However emscripten uses llvm-ld as the linker, which has been removed in llvm 3.2+, and the result is that you will encounter some strange error messages saying that "no such file or directory". If you get this message, check your llvm and clang version.
+
+3. *Get the file system to work*
+{{{
./emcc --preload-file hello_world_file.txt tests/hello_world_file.c -o hello_world_file.html
+}}}
Note that you must add "--preload-file hello_world_file.txt" in the command line. This line tells emcc that it should embed the file loading code into the js file. Before the application runs, all files will be loaded first. If you don't do this, it won't find this file.
\ No newline at end of file