我初学C在我看C prime 时候看到一行代码
#include <stdio.h>
#include <inttypes.h>
int main(void)
{
int32_t me32; // me32 是一个32位的有符号整数变量
me32 = 45933945;
// 第一个printf假设int32_t是int类型
printf("First, assume int32_t is int: ");
printf("me32 = %d\n", me32);
// 第二个printf不做任何假设,使用inttypes.h中的宏
printf("Next, let's not make any assumptions.\n");
printf("Instead, use a \"macro\" from inttypes.h: ");
printf("me32 = %" PRId32 "\n", me32);
return 0;
}
然后提示expected ')' before 'PRId32'
献上我的lauch.json和c_cpp_properties.json便于解决问题
{
"configurations": [
{
"name": "Win32",
"includePath": ["${workspaceFolder}/**"],
"defines": ["_DEBUG", "UNICODE", "_UNICODE"],
"windowsSdkVersion": "10.0.17763.0",
"compilerPath": "E:/x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw64/bin/g++.exe",
"cStandard": "c99",
"cppStandard": "c++17",
"intelliSenseMode": "${default}",
"compilerArgs": ["-std=c99"]
}
],
"version": 4
}
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "E://x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0//mingw64//bin//gdb.exe", /*�ij��Լ�binĿ¼�µ�gdb.exe�������·���͵����︴�Ƶ��ļ�Ŀ¼��һ�㲻һ����������������б��\\*/
"setupCommands": [
{
"description": "Ϊ gdb ���������ӡ",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "task g++"
}
]
}