Embind simple demo doesn't compile

1,027 views
Skip to first unread message

Michael IV

unread,
Mar 7, 2014, 5:36:42 AM3/7/14
to emscripte...@googlegroups.com
I am testing embind with the following chunk of code:

#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#include <emscripten/bind.h>
void glm_add(float x1 ,float y1,float x2,float y2){
printf("Vector summation equals: %f , %f",x1,y2);
}

EMSCRIPTEN_BINDINGS(my_module) {
    function("glm_add", &glm_add);
}


Getting this :

 C:\Users\Michael\documents\visual studio 2010\Projects\EmscriptenDemo\EmscriptenDemo\main.cpp(5): includes this header: 
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\bind.h(10): includes this header: 
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\val.h(4): includes this header: 
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(36,40): error : a space is required between consecutive right angle brackets (use '> >')
1>          struct TypeID<std::unique_ptr<T>> {
1>                                         ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(52,42): error : a space is required between consecutive right angle brackets (use '> >')
1>          struct TypeID<AllowedRawPointer<T>> {
1>                                           ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(136,9): error : unknown type name 'constexpr'
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(char);
1>          ^
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,13):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(136,9): error : expected member name or ';' after declaration specifiers
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(char);
1>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,23):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ~~~~~~~~~ ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(137,9): error : unknown type name 'constexpr'
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(signed char);
1>          ^
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,13):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(137,9): error : expected member name or ';' after declaration specifiers
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(signed char);
1>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,23):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ~~~~~~~~~ ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(138,9): error : unknown type name 'constexpr'
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(unsigned char);
1>          ^
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,13):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(138,9): error : expected member name or ';' after declaration specifiers
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(unsigned char);
1>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,23):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ~~~~~~~~~ ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(139,9): error : unknown type name 'constexpr'
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(signed short);
1>          ^
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,13):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(139,9): error : expected member name or ';' after declaration specifiers
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(signed short);
1>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,23):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ~~~~~~~~~ ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(140,9): error : unknown type name 'constexpr'
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(unsigned short);
1>          ^
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,13):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(140,9): error : expected member name or ';' after declaration specifiers
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(unsigned short);
1>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,23):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ~~~~~~~~~ ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(141,9): error : unknown type name 'constexpr'
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(signed int);
1>          ^
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,13):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(141,9): error : expected member name or ';' after declaration specifiers
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(signed int);
1>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,23):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ~~~~~~~~~ ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(142,9): error : unknown type name 'constexpr'
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(unsigned int);
1>          ^
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,13):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(142,9): error : expected member name or ';' after declaration specifiers
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(unsigned int);
1>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,23):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ~~~~~~~~~ ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(143,9): error : unknown type name 'constexpr'
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(signed long);
1>          ^
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,13):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(143,9): error : expected member name or ';' after declaration specifiers
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(signed long);
1>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,23):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ~~~~~~~~~ ^
1>C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(144,9): error : unknown type name 'constexpr'
1>          EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(unsigned long);
1>          ^
1>  C:\Program Files (x86)\Emscripten\emscripten\1.12.0\system\include\emscripten\wire.h(128,13):  note: expanded from macro 'EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE'
1>              constexpr static WireType toWireType(const type& v) {   \
1>              ^
1>GCCCOMPILE : fatal error : too many errors emitted, stopping now [-ferror-limit=]
1>  20 errors generated.
1>GCCCOMPILE : error root: compiler frontend failed to generate LLVM bitcode, halting
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Jukka Jylänki

unread,
Mar 7, 2014, 5:37:50 AM3/7/14
to emscripte...@googlegroups.com
Did you both compile and link with the --bind flag?


--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael IV

unread,
Mar 7, 2014, 5:41:10 AM3/7/14
to emscripte...@googlegroups.com
Ha!Added --bind to clang commandline window and now getting this:

 main.cpp
1>GCCCOMPILE : warning root: -I or -L of an absolute path "-IC:/Users/Michael/Documents/OpenGL_Stuff/glm-0.9.4.1/glm" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass '-Wno-warn-absolute-paths' to emcc to hide this warning.
1>GCCLINK : warning : unresolved symbol: _embind_register_function
1>GCCLINK : warning : unresolved symbol: _embind_register_void
1>GCCLINK : warning : unresolved symbol: _embind_register_bool
1>GCCLINK : warning : unresolved symbol: _embind_register_integer
1>GCCLINK : warning : unresolved symbol: _embind_register_float
1>GCCLINK : warning : unresolved symbol: _embind_register_std_string
1>GCCLINK : warning : unresolved symbol: _embind_register_std_wstring
1>GCCLINK : warning : unresolved symbol: _embind_register_emval
1>GCCLINK : warning : unresolved symbol: _embind_register_memory_view
1>  EmscriptenDemo.vcxproj -> C:\Users\Michael\documents\visual studio 2010\Projects\EmscriptenDemo\Emscripten\Debug\EmscriptenDemo.js
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


So it seems I can discard those warnings?



--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/d9JnDuXoH-Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Michael Ivanov
Independent Pixel Commander 
onlygraphix.com
Tel:+972 54 4962254

Jukka Jylänki

unread,
Mar 7, 2014, 5:42:53 AM3/7/14
to emscripte...@googlegroups.com
Those should be benign, although waywardmonkeys has reported recently that there's been some problems with calling any of those functions aborting. If your app works properly and you are able to register the bindings, then feel free to ignore those warnings.

Michael IV

unread,
Mar 7, 2014, 5:48:36 AM3/7/14
to emscripte...@googlegroups.com
Great,thanks for your help man!
Reply all
Reply to author
Forward
0 new messages