C++ C++;预期的声明说明符或‘’;在‘之前;(’;标记和预期声明说明符或‘;…’;before字符串常量)
我试图在windows中使用gcc编译RetroArch,但在编译过程中出现错误:C++ C++;预期的声明说明符或‘’;在‘之前;(’;标记和预期声明说明符或‘;…’;before字符串常量),c++,gcc,compiler-errors,C++,Gcc,Compiler Errors,我试图在windows中使用gcc编译RetroArch,但在编译过程中出现错误: In file included from gfx/drivers/d3d10.c:39: gfx/drivers/../common/d3d10_common.h:1121:8: error: expected declaration specifiers or ‘...’ before ‘(’ token 1121 | (!(sizeof(d3d10_uniform_t) & 0xF)
In file included from gfx/drivers/d3d10.c:39:
gfx/drivers/../common/d3d10_common.h:1121:8: error: expected declaration specifiers or ‘...’ before ‘(’ token
1121 | (!(sizeof(d3d10_uniform_t) & 0xF)), "sizeof(d3d10_uniform_t) must be a multiple of 16");
| ^
gfx/drivers/../common/d3d10_common.h:1121:44: error: expected declaration specifiers or ‘...’ before string constant
1121 | (!(sizeof(d3d10_uniform_t) & 0xF)), "sizeof(d3d10_uniform_t) must be a multiple of 16");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gfx/common/d3d10_common.c:20:
gfx/common/d3d10_common.h:1121:8: error: expected declaration specifiers or ‘...’ before ‘(’ token
1121 | (!(sizeof(d3d10_uniform_t) & 0xF)), "sizeof(d3d10_uniform_t) must be a multiple of 16");
| ^
gfx/common/d3d10_common.h:1121:44: error: expected declaration specifiers or ‘...’ before string constant
1121 | (!(sizeof(d3d10_uniform_t) & 0xF)), "sizeof(d3d10_uniform_t) must be a multiple of 16");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:213: obj-unix/release/gfx/drivers/d3d10.o] Error 1
make: *** Se espera a que terminen otras tareas....
make: *** [Makefile:213: obj-unix/release/gfx/common/d3d10_common.o] Error 1
In file included from gfx/drivers_font/d3d10_font.c:26:
gfx/drivers_font/../common/d3d10_common.h:1121:8: error: expected declaration specifiers or ‘...’ before ‘(’ token
1121 | (!(sizeof(d3d10_uniform_t) & 0xF)), "sizeof(d3d10_uniform_t) must be a multiple of 16");
| ^
gfx/drivers_font/../common/d3d10_common.h:1121:44: error: expected declaration specifiers or ‘...’ before string constant
1121 | (!(sizeof(d3d10_uniform_t) & 0xF)), "sizeof(d3d10_uniform_t) must be a multiple of 16");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:213: obj-unix/release/gfx/drivers_font/d3d10_font.o] Error 1
In file included from menu/drivers_display/menu_display_d3d10.c:29:
/home/<user>/retroarch/gfx/common/d3d10_common.h:1121:8: error: expected declaration specifiers or ‘...’ before ‘(’ token
1121 | (!(sizeof(d3d10_uniform_t) & 0xF)), "sizeof(d3d10_uniform_t) must be a multiple of 16");
| ^
/home/<user>/retroarch/gfx/common/d3d10_common.h:1121:44: error: expected declaration specifiers or ‘...’ before string constant
1121 | (!(sizeof(d3d10_uniform_t) & 0xF)), "sizeof(d3d10_uniform_t) must be a multiple of 16");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:213: obj-unix/release/menu/drivers_display/menu_display_d3d10.o] Error 1
周边代码:
#ifndef ALIGN
#ifdef _MSC_VER
#define ALIGN(x) __declspec(align(x))
#else
#define ALIGN(x) __attribute__((aligned(x)))
#endif
#endif
typedef struct ALIGN(16)
{
math_matrix_4x4 mvp;
struct
{
float width;
float height;
} OutputSize;
float time;
} d3d10_uniform_t;
static_assert(
(!(sizeof(d3d10_uniform_t) & 0xF)), "sizeof(d3d10_uniform_t) must be a multiple of 16");
typedef struct d3d10_shader_t
{
D3D10VertexShader vs;
D3D10PixelShader ps;
D3D10GeometryShader gs;
D3D10InputLayout layout;
} d3d10_shader_t;
typedef struct
{
unsigned cur_mon_id;
DXGISwapChain swapChain;
D3D10Device device;
D3D10RasterizerState state;
D3D10RenderTargetView renderTargetView;
D3D10Buffer ubo;
d3d10_uniform_t ubo_values;
D3D10SamplerState samplers[RARCH_FILTER_MAX][RARCH_WRAP_MAX];
D3D10BlendState blend_enable;
D3D10BlendState blend_disable;
D3D10BlendState blend_pipeline;
D3D10Buffer menu_pipeline_vbo;
math_matrix_4x4 mvp, mvp_no_rot;
struct video_viewport vp;
D3D10_VIEWPORT viewport;
DXGI_FORMAT format;
float clearcolor[4];
bool vsync;
bool resize_chain;
bool keep_aspect;
bool resize_viewport;
bool resize_render_targets;
bool init_history;
d3d10_shader_t shaders[GFX_MAX_SHADERS];
#ifdef __WINRT__
DXGIFactory2 factory;
#else
DXGIFactory factory;
#endif
DXGIAdapter adapter;
文件下载:
有人知道怎么修吗?
谢谢。有问题的部分很可能在这一行之前。事实上,您显示的一行代码中有不匹配的括号,因此肯定缺少一些内容。您能提供更多行的周围代码吗?@MaxLanghof:Done。并添加了下载链接。@JeffLee下载链接不应该是问题的一部分。这就是为什么,在问题中就其本身而言,这是一项要求。您如何编译此程序?gcc的哪个版本?(该行在C++03下确实会触发错误,但在引入
static_assert
时,它似乎在C++11下工作。)@JaMiT:$gcc--version/gcc(gcc)9.1.0/版权(C)2019免费软件基金会,Inc. /代码>我使用Mys2我从PACKMAN下载GCC
#ifndef ALIGN
#ifdef _MSC_VER
#define ALIGN(x) __declspec(align(x))
#else
#define ALIGN(x) __attribute__((aligned(x)))
#endif
#endif
typedef struct ALIGN(16)
{
math_matrix_4x4 mvp;
struct
{
float width;
float height;
} OutputSize;
float time;
} d3d10_uniform_t;
static_assert(
(!(sizeof(d3d10_uniform_t) & 0xF)), "sizeof(d3d10_uniform_t) must be a multiple of 16");
typedef struct d3d10_shader_t
{
D3D10VertexShader vs;
D3D10PixelShader ps;
D3D10GeometryShader gs;
D3D10InputLayout layout;
} d3d10_shader_t;
typedef struct
{
unsigned cur_mon_id;
DXGISwapChain swapChain;
D3D10Device device;
D3D10RasterizerState state;
D3D10RenderTargetView renderTargetView;
D3D10Buffer ubo;
d3d10_uniform_t ubo_values;
D3D10SamplerState samplers[RARCH_FILTER_MAX][RARCH_WRAP_MAX];
D3D10BlendState blend_enable;
D3D10BlendState blend_disable;
D3D10BlendState blend_pipeline;
D3D10Buffer menu_pipeline_vbo;
math_matrix_4x4 mvp, mvp_no_rot;
struct video_viewport vp;
D3D10_VIEWPORT viewport;
DXGI_FORMAT format;
float clearcolor[4];
bool vsync;
bool resize_chain;
bool keep_aspect;
bool resize_viewport;
bool resize_render_targets;
bool init_history;
d3d10_shader_t shaders[GFX_MAX_SHADERS];
#ifdef __WINRT__
DXGIFactory2 factory;
#else
DXGIFactory factory;
#endif
DXGIAdapter adapter;