minterdata 2021-04-13 07:17 采纳率: 0%
浏览 265

在64位Windows10下面,如何使用mingw64编译出64位程序?

采用编译命令:

D:\mingw64\bin\gcc -m64 datatype.c -o datatype.exe

编译如下代码:
 

/**********
 * C语言的数据类型 
 * 版本:0.1.0
 * 开发人:沈波
 * 完成时间:2021-4-8
 * 版权所有,侵权必究
 **********/
 
#include <stdio.h>
#include <sys/time.h>
#include <limits.h>
#include <stddef.h>

void main()
{
	unsigned long int i,j;

	/*运行时间测试框架*/ 
	struct timeval timeStart, timeEnd;
	
	/*运行时间测试框架 --------------- 运行起始时间*/ 
	gettimeofday(&timeStart,NULL);
	printf("Start time is: %lu.%lu \n\nYour program start run...\n\n", timeStart.tv_sec, timeStart.tv_usec);	

	/*在这里加入自己的程序*/
	printf("char type size is %d byte. \n",sizeof(char));
	printf("\tMax value is %d.\n\tMin value is %d.\n",CHAR_MAX,CHAR_MIN);
	printf("unsigned char type size is %d byte. \n",sizeof(unsigned char));
	printf("\tMax value is %d.\n",UCHAR_MAX);
	printf("int type size is %d bytes. \n",sizeof(int));
	printf("unsigned int type size is %d bytes. \n",sizeof(unsigned int));
	printf("short type size is %d bytes. \n",sizeof(short));
	printf("unsigned short type size is %d bytes. \n",sizeof(unsigned short));
	printf("long type size is %d bytes. \n",sizeof(long));
	printf("\tMax value is %ld.\n\tMin value is %ld.\n",LONG_MAX,LONG_MIN);
	printf("unsigned long type size is %d bytes. \n",sizeof(unsigned long));
	printf("float type size is %d bytes. \n",sizeof(float));
	printf("double type size is %d bytes. \n",sizeof(double));
	printf("long double type size is %d bytes. \n",sizeof(long double));
	printf("size_t type size is %d bytes. \n",sizeof(size_t));	
	
	/*运行时间测试框架 --------------- 运行结束时间*/
	gettimeofday(&timeEnd,NULL);
	printf("\nEnd time is: %lu.%lu \n", timeEnd.tv_sec, timeEnd.tv_usec);
	if (timeEnd.tv_usec-timeStart.tv_usec<0 )
	{	
		printf("Time consuming is: %lu.%lu s\n", timeEnd.tv_sec-1-timeStart.tv_sec, 1000000+timeEnd.tv_usec-timeStart.tv_usec);
	}
	else
	{
		printf("Time consuming is: %lu.%lu s\n", timeEnd.tv_sec-timeStart.tv_sec, timeEnd.tv_usec-timeStart.tv_usec);
	}
}

得到的datatype.exe程序,运行结果显示:

Start time is: 1618268775.890332

Your program start run...

char type size is 1 byte.
        Max value is 127.
        Min value is -128.
unsigned char type size is 1 byte.
        Max value is 255.
int type size is 4 bytes.
unsigned int type size is 4 bytes.
short type size is 2 bytes.
unsigned short type size is 2 bytes.
long type size is 4 bytes.
        Max value is 2147483647.
        Min value is -2147483648.
unsigned long type size is 4 bytes.
float type size is 4 bytes.
double type size is 8 bytes.
long double type size is 16 bytes.
size_t type size is 8 bytes.

End time is: 1618268775.903324
Time consuming is: 0.12992 s

说明 long int依然是32位的,不是64位。这是怎么回事?

  • 写回答

3条回答 默认 最新

  • 关注
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法