f# -> c++ /CLI问题:名称空间或模块xxx没有定义,但是f# -> c# -> c++ /CLI是可以的。

时间:2021-11-20 04:16:32

Done a lot of googling but finding little info on F# -> C++/CLI

做了很多谷歌搜索,但是在f# -> c++ /CLI中发现了一些信息。

Very simple set up, in C++/CLI

非常简单的设置,在c++ /CLI中。

namespace A {
public ref class B{
 public static void f(){};
}; }

In a C# project the namespace is visible can call f() fine:

在c#项目中,名称空间是可见的,可以调用f()

A.B.f()

In an F# project the namespace is not visable and I get a compile error, and a red squiggly line under A.

在f#项目中,名称空间是不可见的,我得到了一个编译错误,并且在a下面有一个红色的弯弯的线。

If I wrap a call to f() in C# and then call that from F# all is ok.

如果我在c#中调用f(),然后从f#调用它,一切都没问题。

I have made sure the build order is right and references set up. I can't see why F# is not behaving exactly like C#. Anyone got this working? Maybe some project setting needed in F#?

我已经确定了构建顺序是正确的,并建立了引用。我不明白为什么f#的行为不像c#。有人得到这个工作吗?也许f#需要一些项目设置?

It is a pain to have to introduce a C# glue layer ?!?!?!

不得不引入一个c#胶层是件痛苦的事?!?!?!

1 个解决方案

#1


1  

OK it looks like a 2008 problem. A bug?

看起来像是2008年的问题。一个错误?

On my home PC I have downloaded VS C++ 2010 express and the 2010 shell and it works fine.

在我的个人电脑上,我下载了vc++ 2010 express和2010年的shell,它运行良好。

It took me a while to realise that it did not matter that I could not add my C++ project to my solution in the shell - i.e. I just needed to browse to the dll when adding a reference.

我花了一段时间才意识到,我不能将c++项目添加到我在shell中的解决方案中——也就是说,我只是需要在添加引用时浏览到dll。

It is a bit of pain in the work environment since downloading the 2010 shell is probably not going to fly so I will have to make do with my work around of going via C# to get from F# to C++/CLI

由于下载2010年的shell可能不会飞,所以在工作环境中有点痛苦,所以我将不得不通过c#从f#到c++ /CLI进行工作。

Home is 64 bit btw.

家是64位。

Thanks for helping out.

谢谢你的帮忙。

#1


1  

OK it looks like a 2008 problem. A bug?

看起来像是2008年的问题。一个错误?

On my home PC I have downloaded VS C++ 2010 express and the 2010 shell and it works fine.

在我的个人电脑上,我下载了vc++ 2010 express和2010年的shell,它运行良好。

It took me a while to realise that it did not matter that I could not add my C++ project to my solution in the shell - i.e. I just needed to browse to the dll when adding a reference.

我花了一段时间才意识到,我不能将c++项目添加到我在shell中的解决方案中——也就是说,我只是需要在添加引用时浏览到dll。

It is a bit of pain in the work environment since downloading the 2010 shell is probably not going to fly so I will have to make do with my work around of going via C# to get from F# to C++/CLI

由于下载2010年的shell可能不会飞,所以在工作环境中有点痛苦,所以我将不得不通过c#从f#到c++ /CLI进行工作。

Home is 64 bit btw.

家是64位。

Thanks for helping out.

谢谢你的帮忙。