如何强制emmake使用config.h文件并进行预处理

How to force emmake use config.h file and do preprocess?

本文关键字:预处理 文件 何强制 emmake 使用 config      更新时间:2023-10-16

我正在尝试用emscripten(最新)构建项目,我已经完成了emconfigure ./configure。现在试着做emmake make。但是它找不到在预处理指令中需要的new.h文件,我确信本机配置是一个很好的配置文件。它用本地make编译。所以问题是如何让emmake做正确的预处理?

#if defined(UNDER_CE)
# ifndef __WCEALT_H__
inline void * operator new(size_t, void * ptr) { return ptr; }
# endif
#elif defined(AUTOCONF) && defined(HAVE_STDINCLUDES)
# include <new>
#else
# include <new.h>
#endif
PS:也许有人知道如何在编译前做预处理?删除无用的代码?像g++ -e或类似的东西,但我找不到一个好的工作流程与大型项目。 PS: Output emmake:
libtool: compile:  /Users/tau0/reader/emsdk_portable/emscripten/1.16.0/em++ -DHAVE_CONFIG_H -I.. -I. -DNDEBUG -Wall -O3 -Wno-non-virtual-dtor -c GOS.cpp  -fno-common -DPIC -o .libs/GOS.o
In file included from GOS.cpp:63:
In file included from ./GException.h:120:
./DjVuGlobal.h:72:11: fatal error: 'new.h' file not found
# include <new.h>
      ^
1 error generated.

Emconfigure默认禁用stl,因此请检查您的新config.h中的HAVE_STDINCLUDES。