mingw遇到的一个问题

自己的写一小段代码:

#include <stdio.h>
#include <string.h>
#include <lua.h>

int main(int argc,char* argv[]){
        lua_State* L=luaL_newstate();
        char tmp[1024];
        while(!feof(stdin)){
                fgets(tmp,sizeof(tmp),stdin);
                printf("%4lu %s\n",strlen(tmp),tmp);
        }
        return 0;
}

在win7 64位,mingw下编译总是报警告:

format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t' [-Wformat=]    test3.c    /test7/src    line 18    C/C++ Problem

google了一下,试了各种方法,也无结果。
突然灵感一来,想起来mingw是32位系统,难道是因为这个原因,下载mingw64试下。

安装mingw64:http://sourceforge.net/projects/mingwbuilds/

 

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /opt/wordpress/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048