首页 > 解决方案 > Visual Studio 2015 中的外部“C”显式类型错误,DLL 测试代码

问题描述

我正在尝试编译一组非常基本的代码来测试在 R 中使用 VS15 C++ 制作的 DLL 的功能。我遵循了本教程:https ://erpcoder.blog/2016/06/15/how-to-develop- ac-dll-for-r-in-visual-studio-2015/

stdafx.h:

#define WIN32_LEAN_AND_MEAN             
#include <windows.h>

extern “C” __declspec(dllexport) void __cdecl foo(double *in, double *out);

DLL_Test.cpp:

#include "stdafx.h"

void foo(double *in, double *out)
{

    double value = in[0] * 2;

    out[0] = value;

}

VS15 给了我与 stdafx.h 相对应的以下错误:

explicit type is missing ('int' assumed)    
expected a ';'  

非常感谢任何见解。

干杯!

标签: c++visual-studio-2015extern

解决方案



推荐阅读