How to Compile Ecere Files To Emscripten???

Forum for talking about anything else Ecere/eC related.
Post Reply
fasasoftware
Posts: 13
Joined: Wed Sep 30, 2015 1:08 pm

How to Compile Ecere Files To Emscripten???

Post by fasasoftware »

Dear jerome,

I'm trying to compile to javascript...but i cant...or better i don't know how....can you tell me please??how i can???

If i do this work for simple helloworld c++........:

Code: Select all


*************************************************************************************************************

C:\Users\Save\Desktop\t>emcc test.cpp

C:\Users\Save\Desktop\t>emcc test.cpp -0 test.html
ERROR:root:test.html: No such file or directory ("test.html" was expected to be an input file, based on the commandline arguments provided)

C:\Users\Save\Desktop\t>em++ test.cpp -0 test.html
ERROR:root:test.html: No such file or directory ("test.html" was expected to be an input file, based on the commandline arguments provided)

C:\Users\Save\Desktop\t>em++ test.cpp

C:\Users\Save\Desktop\t>em++ test.cpp  -o test.html

C:\Users\Save\Desktop\t>   THIS WORKS FINE!!!!
******************************************************************************************************************

But if if try to compile like this...give me error:

C:\Users\Save\Desktop\t>em++ tictactoe.cpp here below the error:

Code: Select all

C:\Users\Save\Desktop\tictac troppo>em++ tictactoemod.cpp
tictactoemod.cpp:1:1: error: unknown type name 'import'
import "ecere"
^
tictactoemod.cpp:1:8: error: expected unqualified-id
import "ecere"
       ^
tictactoemod.cpp:4:1: error: unknown type name 'define'
define lineWidth = 10;
^
tictactoemod.cpp:5:1: error: unknown type name 'define'
define mastery = 97;
^
tictactoemod.cpp:7:1: error: unknown type name 'define'
define noAvailableMove = -100;
^
tictactoemod.cpp:13:19: error: expected class name
class TicTacToe : Window
                  ^
tictactoemod.cpp:15:4: error: C++ requires a type specifier for all declarations
   caption = "TicTacToe";
   ^
tictactoemod.cpp:15:12: warning: in-class initialization of non-static data
      member is a C++11 extension [-Wc++11-extensions]
   caption = "TicTacToe";
           ^
tictactoemod.cpp:16:4: error: C++ requires a type specifier for all declarations
   background = green;
   ^
tictactoemod.cpp:16:15: warning: in-class initialization of non-static data
      member is a C++11 extension [-Wc++11-extensions]
   background = green;
              ^
tictactoemod.cpp:17:4: error: C++ requires a type specifier for all declarations
   hasClose = true;
   ^
tictactoemod.cpp:17:13: warning: in-class initialization of non-static data
      member is a C++11 extension [-Wc++11-extensions]
   hasClose = true;
            ^
tictactoemod.cpp:18:4: error: C++ requires a type specifier for all declarations
   clientSize = { 400, 400 };
   ^
tictactoemod.cpp:18:15: warning: in-class initialization of non-static data
      member is a C++11 extension [-Wc++11-extensions]
   clientSize = { 400, 400 };
              ^
tictactoemod.cpp:20:4: error: unknown type name 'FontResource'
   FontResource tttFont { "Comic Sans MS", 50, bold = true, window = this };
   ^
tictactoemod.cpp:20:17: error: function definition does not declare parameters
   FontResource tttFont { "Comic Sans MS", 50, bold = true, window = this };
                ^
tictactoemod.cpp:22:20: error: C++ requires a type specifier for all
      declarations
   TTTSquare turn; turn = X;
                   ^
tictactoemod.cpp:22:20: error: duplicate member 'turn'
tictactoemod.cpp:22:14: note: previous declaration is here
   TTTSquare turn; turn = X;
             ^
tictactoemod.cpp:22:25: warning: in-class initialization of non-static data
      member is a C++11 extension [-Wc++11-extensions]
   TTTSquare turn; turn = X;
                        ^
tictactoemod.cpp:52:55: error: unknown type name 'Point'
   float BestMove(TTTSquare t, TTTSquare state[3][3], Point bestMove)
                                                      ^
tictactoemod.cpp:143:20: error: unknown type name 'Surface'
   void DrawPieces(Surface surface)
                   ^
tictactoemod.cpp:174:18: error: unknown type name 'Surface'
   void OnRedraw(Surface surface)
                 ^
tictactoemod.cpp:192:42: error: unknown type name 'Modifiers'
   bool OnLeftButtonDown(int mx, int my, Modifiers mods)
                                         ^
tictactoemod.cpp:218:4: error: unknown type name 'Button'
   Button btnReset
   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
5 warnings and 20 errors generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting


Can you help me please thanks a lot.... LESTROSO :oops: :oops: :oops:
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: How to Compile Ecere Files To Emscripten???

Post by jerome »

Hi Lestroso,

It is a somewhat complicated process to compile projects to Emscripten.
In fact, I am currently trying to get one of our own projects to run.
I should probably post an article about how to do this in the near future.

What you are trying to do in your example though is to give a C++ compiler eC code, so of course that doesn't work too well!

The way it starts is by setting up a new 'Emscripten' compiler in the Ecere IDE's Global Settings/Compilers. There you must configure the toolchain and paths with the proper settings so that it uses Emscripten's Clang compiler with the proper options to compile the C code generated by the eC compiler. I will work on an article describing how to do this in the coming weeks.

Also worth being noted, this must be done using a special development branch of the Ecere SDK where we have support for Emscripten.

More on all this to come.

Best regards,

-Jerome
fasasoftware
Posts: 13
Joined: Wed Sep 30, 2015 1:08 pm

Re: How to Compile Ecere Files To Emscripten???

Post by fasasoftware »

i THANK YOU JEROME....it seem real complicated...i'll wait for your article...bestregards, lestroso :D
fasasoftware
Posts: 13
Joined: Wed Sep 30, 2015 1:08 pm

Re: How to Compile Ecere Files To Emscripten???

Post by fasasoftware »

Dear Jerome,

why don't you make an app to convert a "project.epj" to html5 with emscripten?? you could make it easy from everyone...and it sound good...

I thank you a lot jerome again....

best regards,

lestroso :D
Post Reply