外部 "C" Visual Studio 2015 中的显式类型错误,DLL 测试代码
Extern "C" explicit type error in Visual Studio 2015, DLL test code
我正在尝试编译一组非常基本的代码来测试在R中使用VS15 C++制作的DLL的功能。我遵循了本教程:https://erpcoder.blog/2016/06/15/how-to-develop-a-c-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 ';'
任何见解都非常感谢。
干杯!
你的代码中真的有智能引号吗:extern “C”
?
我怀疑您可能这样做,因为您从中剪切或粘贴代码的网站也有它们(在我看来,很多,可能是寻找另一个网站的一个很好的理由,但你同样可以使用他们的代码,只要你很乐意修复其中的错误(。
你应该用更愚蠢(但更容易接受(的引号替换它们:
extern "C" __declspec(dllexport) void __cdecl foo(double *in, double *out);
// ^ ^
// Here
顺便说一句,我在网站上留下了一条评论,建议他们解决问题(目前正在等待审核(。
相关文章:
- 我的模板类方法返回错误类型?
- 错误:类型"double()"和"double()"的操作数无效到二进制&quo
- 类型为 "int*" 的参数与 C++ 中错误类型"int**"参数不兼容
- glDrawElements GL 错误类型 = 0x824c,严重性 = 0x9146,消息 = GL_INVALID
- Eclipse/CDT_C++给出"语义错误_"类型XXX无法解决"。项目运行
- turbo 为什么我的C++代码中出现错误类型名称预期"错误?
- "auto"推断出 hashtable_policy.h 中的错误类型
- 设计自己的结果/两者之一:是否应该始终指定成功类型和错误类型
- 如何修复"ctypes"。参数错误:参数 2:<键入"异常.类型错误">:RaspberryPi 中的错误类型"错误
- 在 vscode 上编译错误.类型说明符是 C++11 扩展
- 不允许使用错误类型
- 当读取错误类型时,CIN覆盖我的初始化值
- C++:"错误:类型'const char*'和'const char [28]'的操作数无效到二进制'ope
- 我的代码错误类型警告 1 警告 C4018 和更多错误
- 在shared_from_this()中的错误类型(在继承类中)(是否有dyn.type-ware shared Poi
- 为什么缩小转换范围不能防止错误类型的map.insert()失败
- 程序总是返回二进制'>>':找不到运算符,它采用错误类型的左操作数
- 错误:类型为 '.&' 来自类型的临时 '..*康斯特'
- 涉及将要馈送的向量转换为execvp的错误类型
- C++中是否存在错误类型