标签: c++-cli

由于 cli::array 关键字 Visual Studio,C++ 无法使用 std::array

我想声明 a std::array,但数组部分被识别为cli::array关键字(请参阅Why is "array" mark as a returned word in Visual-C++?),这意味着 thestd::不会影响它。如何自动停止Visual Studiousing namespace cli,或指定我要使用std::array

蓝色数组字被识别为关键字

蓝色数组字被识别为关键字

c++ c++-cli visual-studio stdarray

0
推荐指数
1
解决办法
388
查看次数

错误C2976:'std :: tr1 :: array':MS C++ express 2010中的模板参数太少

我正在使用C++ Express 2010中的Windows窗体项目.对Form.h进行了一些更改,现在编译程序时出现错误.注意编译器显示错误是在主程序- open gl test 2-即#includes形式.在我开发代码时,所有编译好了好几天,然后昨晚改变了一些东西,现在我得到了错误.

open gl test 2中的主程序与我创建的任何其他基于表单的项目相同 - 我比较检查[除了命名空间的明显变化等导致其不同的项目]

// open gl test 2.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"

using namespace opengltest2;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
    // Enabling Windows XP visual effects before any controls are created
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false); 

    // Create the main window and run it
    Application::Run(gcnew Form1());
    return 0;
} 
Run Code Online (Sandbox Code Playgroud)

错误是:

1>open gl test 2.cpp(9): error C2976: 'std::tr1::array' : too few template arguments
1>          D:\Program Files …
Run Code Online (Sandbox Code Playgroud)

c++ c++-cli

-1
推荐指数
1
解决办法
1万
查看次数

C++/CLI 中的感叹号

我正在阅读Microsoft 的这篇关于如何将托管类编组到本机以及相反的文章,我遇到了这些内容:

我在 Google 和 StackOverflow 上搜索了上述代码片段中感叹号 ( ) 的含义!,但我没有找到任何相关内容,所以我在这里询问是否有人可以解释这一点。

预先感谢任何愿意回答的人。

c++ syntax c++-cli

-1
推荐指数
1
解决办法
526
查看次数

与 - > EndsWith()相反

与字符串比较相反的是什么

thisString->的endsWith( "字符串")

如果它不以......结束

c++-cli visual-c++

-2
推荐指数
1
解决办法
353
查看次数

仅在释放模式下内存泄漏

我正在使用C#前端在VS2010中开发一个应用程序,它通过C++/CLI包装器使用本机C++ DLL.我注意到只有在发布模式下才会发生严重的内存泄漏(或引用泄漏).在调试模式下,应用程序的内存占用量是稳定的.

我已将问题的根源缩小到视频播放循环,并且在某些时候相当有信心视频数据没有被正确处理.但是,我想知道我应该特别关注仅在发布模式下发生的泄漏.

值得一提的是,在我所讨论的C++/CLI类中,我正在实现这里给出的dispose/finalize模式.

c# c++ memory-leaks c++-cli visual-studio-2010

-2
推荐指数
1
解决办法
841
查看次数

如何为 System.String 定义类型别名^

I\xc2\xb4m 尝试定义我自己的类型别名,如下所示:

\n\n
using PrjString = System.String;\nusing PrjInt = System.Int32;\nusing PrjFloat = System.Single;\nusing PrjDateTime = System.DateTime;\n
Run Code Online (Sandbox Code Playgroud)\n\n

I\xc2\xb4m 面临类型问题String。当我尝试使用该字符串并将其作为参考传递时:

\n\n
PrjString^ name;\nGetName(name); // Receives name as reference and return the gathered name\n
Run Code Online (Sandbox Code Playgroud)\n\n

我无法编译:

\n\n
PrjString ^name: error CS0118: `string` is a `type` but is used like a `variable`\n
Run Code Online (Sandbox Code Playgroud)\n\n

另一方面,如果我定义:

\n\n
using PrjString = System.String^; \n
Run Code Online (Sandbox Code Playgroud)\n\n

它也不能编译:

\n\n
using PrjString = System.String^: error CS1002: ; expected\n
Run Code Online (Sandbox Code Playgroud)\n\n

有没有办法定义类型别名System.String^

\n

c# c++-cli

-2
推荐指数
1
解决办法
2220
查看次数

^在C#方法调用中做了什么

我无法看到^在C#方法调用中找出目的.

例如:

SomeObject::somemethod(ObjArg^ arg)
{
    // method body
}
Run Code Online (Sandbox Code Playgroud)

有什么影响^

c# syntax c++-cli

-5
推荐指数
1
解决办法
126
查看次数