未使用emscripten找到Windows.h

问题描述 投票:3回答:1

我正在尝试在Windows上使用Emscripten在javascript中转换C库。我使用了教程here来设置脚本,并使用LLVM / Clang入门。我使用Visual Studio 2010编译了LLVM。clang的版本为:

clang版本3.2(标签/ RELEASE_32 / final)目标:i686-pc-win32线程模型:posix

在命令行上,我编写此行来编译我的文件:

C:\ emscripten> python emcc -v \ mypath \ myfile.c

这是输出,最终是我得到的错误(以及我寻求帮助的原因...)

emcc: compiling to bitcode
emcc: compiling source file:  \mypath\myfile.c
emcc running: C:\llvm\build\bin\release\clang -m32 -U__i386__ -U__x86_64__ -U__i
386 -U__x86_64 -Ui386 -Ux86_64 -U__SSE__ -U__SSE2__ -U__MMX__ -UX87_DOUBLE_ROUND
ING -UHAVE_GCC_ASM_FOR_X87 -DEMSCRIPTEN -U__STRICT_ANSI__ -U__CYGWIN__ -D__STDC_
_ -Xclang -triple=i386-pc-linux-gnu -D__IEEE_LITTLE_ENDIAN -fno-math-errno -fno-
ms-compatibility -nostdinc -Xclang -nobuiltininc -Xclang -nostdsysteminc -Xclang
 -isystemC:\emscripten\system\local\include -Xclang -isystemC:\emscripten\system
\include\libcxx -Xclang -isystemC:\emscripten\system\include -Xclang -isystemC:\
emscripten\system\include\emscripten -Xclang -isystemC:\emscripten\system\includ
e\bsd -Xclang -isystemC:\emscripten\system\include\libc -Xclang -isystemC:\emscr
ipten\system\lib\libcxxabi\include -Xclang -isystemC:\emscripten\system\include\
gfx -Xclang -isystemC:\emscripten\system\include\net -Xclang -isystemC:\emscript
en\system\include\SDL -U__APPLE__ -U__linux__ -D_LIBCPP_HAS_NO_DELETED_FUNCTIONS
 -v -emit-llvm -c \mypath\myfile.c -o C:\tempo\tmpn8yiq5\myfile_0.o
clang version 3.2 (tags/RELEASE_32/final)
Target: i686-pc-win32
Thread model: posix
 "C:/llvm/build/bin/release/clang.exe" -cc1 -triple i686-pc-win32 -emit-llvm-bc
-disable-free -disable-llvm-verifier -main-file-name myfile.c -mrelocation-mod
el static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu pent
ium4 -momit-leaf-frame-pointer -v -coverage-file "C:\\tempo\\tmpn8yiq5\\myfile_0
.o" -nostdsysteminc -nobuiltininc -resource-dir "C:/llvm/build/bin/release\\..
\\lib\\clang\\3.2" -U __i386__ -U __x86_64__ -U __i386 -U __x86_64 -U i386 -U x8
6_64 -U __SSE__ -U __SSE2__ -U __MMX__ -U X87_DOUBLE_ROUNDING -U HAVE_GCC_ASM_FO
R_X87 -D EMSCRIPTEN -U __STRICT_ANSI__ -U __CYGWIN__ -D __STDC__ -D __IEEE_LITTL
E_ENDIAN -U __APPLE__ -U __linux__ -D _LIBCPP_HAS_NO_DELETED_FUNCTIONS -fmodule-
cache-path "C:\\Users\\SS\\AppData\\Local\\Temp\\clang-module-cache" -ferror-lim
it 19 -fmessage-length 80 -mstackrealign -fms-extensions -fmsc-version=1300 -fde
layed-template-parsing -fobjc-runtime=gcc -fobjc-default-synthesize-properties -
fdiagnostics-show-option -fcolor-diagnostics -triple=i386-pc-linux-gnu -nobuilti
ninc -nostdsysteminc "-isystemC:\\emscripten\\system\\local\\include" "-isystemC
:\\emscripten\\system\\include\\libcxx" "-isystemC:\\emscripten\\system\\include
" "-isystemC:\\emscripten\\system\\include\\emscripten" "-isystemC:\\emscripten\
\system\\include\\bsd" "-isystemC:\\emscripten\\system\\include\\libc" "-isystem
C:\\emscripten\\system\\lib\\libcxxabi\\include" "-isystemC:\\emscripten\\system
\\include\\gfx" "-isystemC:\\emscripten\\system\\include\\net" "-isystemC:\\emsc
ripten\\system\\include\\SDL" -o "C:\\tempo\\tmpn8yiq5\\myfile_0.o" -x c "\\mypa
th\\myfile.c"
clang -cc1 version 3.2 based upon LLVM 3.2svn default target i686-pc-win32
ignoring nonexistent directory "C:\emscripten\system\local\include"
#include "..." search starts here:
#include <...> search starts here:
 C:\emscripten\system\include\libcxx
 C:\emscripten\system\include
 C:\emscripten\system\include\emscripten
 C:\emscripten\system\include\bsd
 C:\emscripten\system\include\libc
 C:\emscripten\system\lib\libcxxabi\include
 C:\emscripten\system\include\gfx
 C:\emscripten\system\include\net
 C:\emscripten\system\include\SDL
End of search list.
\mypath\myfile.c:4:10: fatal error: 'windows.h'
      file not found
#include <windows.h>
         ^
1 error generated.
emcc: compiler frontend failed to generate LLVM bitcode, halting

C文件不使用任何MFC,据我所知,clang 3.2版应该能够使用标准的Windows API。我检查了Windows.h是否在某个位置,并且它位于C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v7.1A \ Include

我是否错过了某些东西,例如指定我正在使用Win32进行编译的配置或标志?我还注意到在llvm存储库中,lib / Support / Windows中有Windows.h文件,但我不知道它的用途是什么。这看起来像是某种可移植性包装程序,可以使用来自不同库的标准C ++。

我不知道从那里去哪里,将不胜感激。

c windows llvm file-not-found
1个回答
-1
投票

Emscripten没有文件所需的Javascript端口,例如windows.h或OSX的Cocoa。

唯一的解决方案是将代码移植到SDL,因为SDL在emscripten中可用,因此在其标头中也可用。

© www.soinside.com 2019 - 2024. All rights reserved.