



find /usr -name Emscripten.cmake

/usr/share/emscripten/cmake/Modules/Platform/Emscripten.cmake


find /usr -wholename "*/emscripten/bind.h"

/usr/share/emscripten/system/include/emscripten/bind.h
/usr/share/emscripten/cache/sysroot/include/emscripten/bind.h
上面那个文件夹缺version.h
include_directories(/usr/share/emscripten/cache/sysroot/include/)



apt的不行
git clone https://github.com/emscripten-core/emscripten.git
/home/chen/代码/chili3d/cpp/build/emscripten/system/include


export PATH="/home/chen/软件/emsdk:$PATH"
export EMSDK="/home/chen/软件/emsdk"
export EM_CONFIG="$EMSDK/.emscripten"
export EMSCRIPTEN="$EMSDK/upstream/emscripten"





总结,加环境变量,bootstrap一下就好了
The "workspaces" field in package.json is not supported by pnpm. Create a "pnpm-workspace.yaml" file instead.
+

用pnpm i 会这样

npm install -g cnpm --registry=https://registry.npmmirror.com


cpp
#include "shared.hpp"
#include <emscripten/bind.h>
#include <iostream>
#include <string>
using namespace emscripten;
class HelloWorld {
public:
static std::string sayHello() {
return "Hello, World from C++!";
}
static std::string greet(const std::string& name) {
return "Hello, " + name + " from C++!";
}
};
EMSCRIPTEN_BINDINGS(HelloWorld) {
class_<HelloWorld>("HelloWorld")
.class_function("sayHello", &HelloWorld::sayHello)
.class_function("greet", &HelloWorld::greet);
}


