chili3d 笔记16 emscripten配置 |用cnpm i 安装 |hello world 编译

复制代码
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);  
}
相关推荐
二哈赛车手7 小时前
新人笔记---多策略搭建策略执行链实现RAG检索后过滤
java·笔记·spring·设计模式·ai·策略模式
Brilliantwxx7 小时前
【C++】String的模拟实现(代码实现与坑点讲解)
开发语言·c++·笔记·算法
zhangrelay7 小时前
ROS Kinetic-信号与系统-趣味案例
linux·笔记·学习·ubuntu
羊群智妍8 小时前
2026 GEO监测工具|AI搜索优化技术方案与选型
笔记
maosheng11468 小时前
RHCE的第一次笔记
服务器·网络·笔记
ZC跨境爬虫8 小时前
跟着 MDN 学 HTML day_8:(高级文本语义标签+适配核心功底)
前端·css·笔记·ui·html
就叫飞六吧8 小时前
Hermes Agent 完整总结
笔记
HERR_QQ8 小时前
端到端课程自用 5 规划 基于Difussion 的端到端planner AI 笔记
人工智能·笔记·学习·自动驾驶
William Dawson16 小时前
2026软考中级系统集成项目管理工程师备考笔记
笔记·系统集成项目管理工程师
love530love19 小时前
精简版|Claude-HUD 插件介绍 + 一键安装教程
人工智能·windows·笔记