Сгенерированные исходники Cgo не могут скомпилироваться на MVC

У меня есть общая библиотека, созданная с помощью CGo, и она прекрасно работает на Linux и Android. Но при компиляции в Windows 10 с Microsoft Visual Studio 2017 я получаю следующие ошибки:

Microsoft (R) Program Maintenance Utility Version 14.16.27024.1
Copyright (C) Microsoft Corporation.  All rights reserved.

cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG -I. -Irelease -I..\..\Qt\5.12.0\msvc2017_64\include -I..\..\Qt\5.12.0\msvc2017_64\include\QtQuickControls2 -I..\..\Qt\5.12.0\msvc2017_64\include\QtQuick -I..\..\Qt\5.12.0\msvc2017_64\include\QtGui -I..\..\Qt\5.12.0\msvc2017_64\include\QtANGLE -I..\..\Qt\5.12.0\msvc2017_64\include\QtQml -I..\..\Qt\5.12.0\msvc2017_64\include\QtNetwork -I..\..\Qt\5.12.0\msvc2017_64\include\QtCore -Irelease -I\include -I..\..\Qt\5.12.0\msvc2017_64\mkspecs\win32-msvc -Forelease\ @C:\Users\Nick\AppData\Local\Temp\nm2B40.tmp
connekt.cpp
c2.cpp
cgo-gcc-export-header-prolog(15): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
cgo-gcc-export-header-prolog(15): error C2146: syntax error: missing ';' before identifier 'GoUintptr'
cgo-gcc-export-header-prolog(18): error C2146: syntax error: missing ';' before identifier 'GoComplex64'
cgo-gcc-export-header-prolog(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
cgo-gcc-export-header-prolog(19): error C2371: '_Complex': redefinition; different basic types
cgo-gcc-export-header-prolog(18): note: see declaration of '_Complex'
cgo-gcc-export-header-prolog(19): error C2146: syntax error: missing ';' before identifier 'GoComplex128'
cgo-gcc-export-header-prolog(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.

Заголовок (.h) библиотеки генерируется Cgo и содержит следующие строки:

typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
//typedef __SIZE_TYPE__ GoUintptr;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;

Например, одна из ошибок сообщается в этой строке:

typedef float _Complex GoComplex64;

Но float _Complex это уже определенный тип, почему он не может быть связан с GoComplex64?

Чтобы исправить GoUintptr Я прокомментировал size_type линия и заменил его size_t, но он также не компилируется:

//typedef __SIZE_TYPE__ GoUintptr;
typedef size_t GoUintptr;

Что можно сделать здесь, чтобы исправить эти ошибки компиляции? Может быть, есть некоторые флаги, которые делают Visual C ++ не таким строгим? (потому что на других платформах у меня нет проблем)

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector