English 中文(简体)
C++至目标C ,使用 a子
原标题:C++ to Objective-C , using a const int in a for loop

在我的主人档案中,我有过。

const int a = 4;

在我的来文方档案中,a.cpp(延期是用的,但类型是客观的 c),即

#import "a.h"

int func(){
    for(int i = 0; i < a -1 ; i++){
    }
}

然而,在编纂时,我发现错误“无法找到一份议定书声明”。

为什么发生这种情况,我如何确定这一点?

感谢!

问题回答

您的守则本身是正确的——没有必要订立一项议定书和汇编<条码>a.cpp,定义为<条码>。

作为附带说明,您可离开a.h,定义为sourcecode.c.h。 即便它含有纯C++,它还是把<代码>#includes或#imports/code>的文档分类。

我看到了一些事例,即休养包括/进口可产生假象。

除此之外, 也许XCode项目已经停止——你是否尝试建立新的Skeleton项目,并将这些档案加起来?





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?