我从其他帖子中阅读了很多关于这个问题的信息,但我找不到任何特定于我的情况的内容。
我有一个在 VS 2017 社区中成功符合的 C++ 大型项目。我通过程序 VS 代码使用 SWIG 将同一个项目包装在 Go 中。
现在我在 Go 中的第 1 行收到错误,“package main”
# _/C_/Users/daramsey/Desktop/GoWrapC/CameraFinal/CameraFinal
In file included from ConnectionRecovery.h:2:0,
from ConnectionRecovery.cpp:1:
stdafx.h:38:64: fatal error: afxwin.h: No such file or directory
compilation terminated.(undefined)
ConnectionRecovery.h 看起来像这样:
#pragma once
#include "stdafx.h"
#include "PvBaseLib.h"
#include "PvBuffer.h"
#include "PvBufferLib.h"
#include "PvSystem.h"
#include "PvTypes.h"
class ConnectionRecoveryApp
{
public:
ConnectionRecoveryApp();
~ConnectionRecoveryApp();
void startCamera(PvString mConnectionID);
uint16_t * retrieveDataPointerPerBuffer(PvPipeline* mPipeline);
void stopCamera();
vector<PvString> vectorOfCameras();
private:
PvString mConnectionID;
PvDevice* mDevice;
PvStream* mStream;
PvPipeline* mPipeline;
int mHeight = 512;
int mWidth = 640;
bool mbSaveAsCSV;
};
在我的 stdafx.h 文件(包含在项目中的头文件)中,我发现
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdhtml.h>
#include <afxmt.h>
当我将鼠标悬停在 afxwin.h 上按 F12 键时,我可以打开文件的内容。因此,我假设代码在打开文件时应该没有问题。
这是 VS Code 的 json 文件
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17763.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
问题是什么?如果您需要详细说明,请告诉我。