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);  
}
相关推荐
yi0111 小时前
LeetCode 219:存在重复元素 II——哈希表记录“最近一次出现的位置”
数据结构·人工智能·笔记·python·算法·leetcode·哈希表
志尊宝2 小时前
Vue3 零基础每日笔记(073):keep-alive 页面缓存实战——列表页返回不丢状态
vue.js·笔记·缓存·#vue #前端 #前端开发·#javascript·#vue.js
weixin_448119944 小时前
Datawhale Easy Data × AI:笔记1 已重做,看新的笔记
笔记
要开心吖ZSH5 小时前
MySQL 慢 SQL 排查操作手册-个人笔记版
java·笔记·sql·mysql·慢查询
咖啡忍者6 小时前
【SAP】程制造生产计划PP-PI(Production Planning for Process Industries)
笔记
Titan20247 小时前
MySQL索引学习笔记
笔记·学习·mysql
zhangrelay7 小时前
Arduino-MEGA-ESP单片机理论课笔记02-硬件-2026
笔记·单片机·嵌入式硬件
AOI小白新手上路8 小时前
VDMamba·AutoDL 复现笔记 · 学习笔记
笔记·学习
ACP广源盛139246256739 小时前
USB3.0 高速信号切换方案评估,LH3412 @ACP双通道差分开关硬件选型笔记
笔记·硬件架构·硬件工程·国产芯片·开关
自不量力的A同学9 小时前
Goldfish Scheme v18.11.39 发布了:迈向现代宏系统与多核并发
笔记