在Arm环境中,这样写报错了,报错为 error: expected initializer before ‘xxxOperation’ class SCI_DLL_EXPORTS xxxOperation ^~~~~~~~~~~~~~~~~ #pragma once
#include "Data.h"
#define DLL_EXPORTS
#ifdef DLL_EXPORTS
#define A_DLL_EXPORTS __declspec(dllexport)
#else
#define A_DLL_EXPORTS __declspec(dllimport)
#endif
namespace A
{
class A_DLL_EXPORTS XXXOperation
{
public:
XXXOperation();
~XXXOperation();
之前的宏定义修改为
// 定义导出和导入规范
#if defined(_WIN32) || defined(_WIN64)
#ifdef DLL_EXPORTS
#define SCI_DLL_EXPORTS __declspec(dllexport)
#else
#define SCI_DLL_EXPORTS __declspec(dllimport)
#endif
#else
#define SCI_DLL_EXPORTS
#endif
看起来你使用了 __declspec(dllexport)
和 __declspec(dllimport)
这两个宏,这通常用于 Windows 平台的动态链接库(DLL)的导入和导出。在ARM环境中,这些宏可能不被支持,特别是在非Windows系统上。
如果你的代码是为ARM平台编写的,你可能需要考虑不使用这些特定于Windows的宏。取而代之的是,你可以使用条件编译来根据不同的平台定义导出和导入规范。
修改你的代码如下: