You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PS C:\Users\AlexC\Documents\GitHub\write-a-C-interpreter> gcc -m32 -o xc xc.c
xc.c: In function 'next':
xc.c:111:57: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if (current_id[Hash] == hash && !memcmp((char *)current_id[Name], last_pos, src - last_pos)) {
^
xc.c:121:32: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
current_id[Name] = (int)last_pos;
^
xc.c:188:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
token_val = (int)last_pos;
^
xc.c: In function 'expression':
xc.c:363:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
data = (char *)(((int)data + sizeof(int)) & (-sizeof(int)));
^
xc.c:363:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
data = (char *)(((int)data + sizeof(int)) & (-sizeof(int)));
^
xc.c:629:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
*addr = (int)(text + 3);
^
xc.c:633:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
*addr = (int)(text + 1);
^
.....
编译模板代码的时候会报open,read,close未定义先使用的错误:
PS C:\Users\AlexC\Documents\compiler> gcc -m32 .\compiler.c .\helloworld.c
.\compiler.c: In function 'main':
.\compiler.c:46:15: warning: implicit declaration of function 'open' [-Wimplicit-function-declaration]
if ((fd = open(*argv, 0)) < 0) {
^~~~
.\compiler.c:56:14: warning: implicit declaration of function 'read' [-Wimplicit-function-declaration]
if ((i = read(fd, src, poolsize-1)) <= 0) {
^~~~
.\compiler.c:61:5: warning: implicit declaration of function 'close' [-Wimplicit-function-declaration]
close(fd);
在论坛上找到相似问题,但还是无法解决,如引入以下头文件:
#include <fcntl.h> // for open
#include <unistd.h> // for close
是我本地的gcc版本有问题吗?还是必须要在linux环境下运行?
The text was updated successfully, but these errors were encountered:
您好~我直接从仓库拉代码下来无法编译通过:
os: win10 64bit
gcc: MinGW.org GCC-6.3.0-1
编译模板代码的时候会报
open
,read
,close
未定义先使用的错误:在论坛上找到相似问题,但还是无法解决,如引入以下头文件:
是我本地的gcc版本有问题吗?还是必须要在linux环境下运行?
The text was updated successfully, but these errors were encountered: