C ++头文件错误 [英] C++ Header File Errors

查看:165
本文介绍了C ++头文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是创建一个C#接口,其中包含了一些在开源CrytoLib C ++项目中使用的方法。我试图创建一个管理包装的LIB文件...但我已经得到一些错误,不能弄清楚我做错了,因为这看起来很直接到这一点。



我的头文件:

  // CryptoLibWrapper.h 

#pragma once

使用命名空间System;

命名空间CryptoLibWrapper {

public ref class DefaultDecryptorWithMAC
{
public:
BOOL解密(BYTE const * pEncrypted,UINT uLength,BYTE ** ppBuffer,DWORD * pdwLength);
};
}

我得到的错误...



> 错误C2146:语法错误:缺少';'之前的语法错误:


$ b <标识符Decrypt



错误C4430:缺少类型说明符 - int。注意:C ++不支持default-int



错误C4430:缺少类型说明符 - int。注意:C ++不支持default-int


一直以来,我已经做了任何C ++,这很容易,我只是脑死了。



再次感谢!



所有错误都在BOOL Decrypt ...行

解决方案

似乎你可能得到第一个错误因为你缺少一些类型定义。其他错误可能只是因为缺少定义的结果。



您需要包含一个定义BYTE的文件。把这放在你的文件的顶部应该做的工作:

  #include< windows.h> 

或者如果你不在乎整个窗口标题,你可以尝试:

  #include< windef.h> 


I have been tasked to create a C# interface with some of the methods that are being using in the Open Source CrytoLib C++ project. I am trying to create a managed wrapper for the LIB file... however I am getting some errors already and cannot figure out what I am doing wrong as this seems pretty straightforward to this point.

My header file:

// CryptoLibWrapper.h

#pragma once

using namespace System;

namespace CryptoLibWrapper {

public ref class DefaultDecryptorWithMAC
{
public:
    BOOL Decrypt(BYTE const* pEncrypted, UINT uLength, BYTE** ppBuffer, DWORD* pdwLength);
};
}

The errors I am getting...

error C2061: syntax error : identifier 'BYTE'

error C2146: syntax error : missing ';' before identifier 'Decrypt'

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

It has been a while since I have done any C++ and even that was limited, hoping this is easy and I am just being brain dead.

Thanks again!

EDIT: Note... all of the errors are at the "BOOL Decrypt..." line

解决方案

Seems like you're probably getting the first error because you're missing some type definitions. The other errors are probably just as a result of those missing definitions.

You need to include a file that defines BYTE. Putting this at the top of your file should do the job:

#include <windows.h>

or if you don't care about pulling in the whole of the windows headers, you could try:

#include <windef.h>

这篇关于C ++头文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆