Scenario 1:
//a.cpp
int add(int a, int b) { return 0; }
int add2(int a, int b) { return 0; }
int add3(int a, int b) { return 0; }
b.cpp is identical to a.cpp
//test.cpp
int add2(int, int);
int add3(int, int);
int main(){
add2(1,1);
add3(1,1);
return 0;
}
Compile and link without error:
U:\test>emcc -c a.cpp
U:\test>emcc -c b.cpp
U:\test>emcc -c test.cpp
U:\test>emar rc libtest.a a.o b.o
U:\test>emcc -o test.js test.o libtest.a
Scenario 2:
//a.cpp
int add(int a, int b) { return 0; }
//int add2(int a, int b) { return 0; }
int add3(int a, int b) { return 0; }
//b.cpp
int add(int a, int b) { return 0; }
int add2(int a, int b) { return 0; }
//int add3(int a, int b) { return 0; }
Compile and link with error:
U:\test>emcc -c a.cpp
U:\test>emcc -c b.cpp
U:\test>emar rc libtest.a a.o b.o
U:\test>emcc -o test.js test.o libtest.a
ERROR: Linking globals named '_Z3addii': symbol multiply defined!
My question is why scen2 throw errors but not happen in scen1? Is this the
standard behavior of emscripten build-chain?
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.