Lua和Visual C++

我有一个简单的问题。当我打开 VC++,创建一个“空项目”,插入 Lua 5.2.0 源代码,然后进行编译,我没有发现错误。但是,当我在开始时选择“Windows Forms 应用程序”,然后执行相同的操作,我会遇到一堆错误。可能是什么原因呢?

编辑:

这些错误与某些函数的安全版本有关:

1>..\lua-5.2.0\src\lua.c(102): error C3861: 'signal': identifier not found
1>..\lua-5.2.0\src\lua.c(178): error C3861: 'signal': identifier not found
1>..\lua-5.2.0\src\lua.c(180): error C3861: 'signal': identifier not found
1>  luac.c
1>..\lua-5.2.0\src\luac.c(43): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(157) : see declaration of 'strerror'
1>..\lua-5.2.0\src\luac.c(178): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234) : see declaration of 'fopen'
1>  lundump.c
1>  lvm.c
1>..\lua-5.2.0\src\lvm.c(53): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371) : see declaration of 'sprintf'
1>  lzio.c
1>  Generating Code...

原文链接 https://stackoverflow.com/questions/9439262

点赞
stackoverflow用户1103781
stackoverflow用户1103781

可能是因为当你创建一个Windows表单应用程序时,它实际上是使用托管的C++(使用.NET),我认为Lua不兼容。看看http://luaplus.org/,那可能是你在寻找的东西。它似乎是适用于任何.NET语言(其中包括托管的C++)的Lua。

2012-02-24 23:58:59