在 XE2 上它编译没有问题,在 XE5 上显示这些错误:
FMX.HintManager.pas(79): E2291 Missing implementation of interface method IControl.GetIsFocused
FMX.HintManager.pas(79): E2291 Missing implementation of interface method IControl.GetEnabled
FMX.HintManager.pas(79): E2291 Missing implementation of interface method IControl.GetAbsoluteEnabled
FMX.HintManager.pas(79): E2291 Missing implementation of interface method IControl.GetPopupMenu
FMX.HintManager.pas(79): E2291 Missing implementation of interface method IControl.EnterChildren
FMX.HintManager.pas(79): E2291 Missing implementation of interface method IControl.ExitChildren
FMX.HintManager.pas(79): E2291 Missing implementation of interface method IControl.DoActivate
FMX.HintManager.pas(79): E2291 Missing implementation of interface method IControl.DoDeactivate
FMX.HintManager.pas(79): E2291 Missing implementation of interface method IControl.MouseClick
FMX.HintManager.pas(79): E2291 Missing …Run Code Online (Sandbox Code Playgroud) 我有一些我想运行的代码。我是 python 的新手,也是 stackoverflow
这是python程序:
# Circle Inversion Fractals (Apollonian Gasket) (Escape-time Algorithm)
# FB36 - 20131031
import math
import random
from collections import deque
from PIL import Image
imgx = 512; imgy = 512
image = Image.new("RGB", (imgx, imgy))
pixels = image.load()
n = random.randint(3, 6) # of main circles
a = math.pi * 2.0 / n
r = math.sin(a) / math.sin((math.pi - a) / 2.0) / 2.0 # r of main circles
h = math.sqrt(1.0 - r * …Run Code Online (Sandbox Code Playgroud) 我写函数,检查是字符串是否只包含字母。如果我n在循环外声明:
int n = strlen(str);
for (int i = 0; i < n; i++)
Run Code Online (Sandbox Code Playgroud)
它没有错误并且效果很好,但是如果我n在里面移动声明:
for (int i = 0, int n = strlen(str); i < n; i++)
Run Code Online (Sandbox Code Playgroud)
我有错误:
vigenere.c:71:21: error: expected identifier or '('
for (int i = 0, int n = strlen(str); i < n; i++)
^
vigenere.c:71:21: error: expected ';' in 'for' statement specifier
vigenere.c:71:21: error: expected expression
vigenere.c:71:46: error: use of undeclared identifier 'n'
for (int i = 0, int n = …Run Code Online (Sandbox Code Playgroud) 有人能告诉我为什么下面的代码无法编译吗?我试图自己解决这个问题,但我发现的每个答案似乎都与当前的问题略有不同。这是尝试编译的结果:
\n\njefferson@ubuntu:~$ g++ -std=c++14 templates.cpp\ntemplates.cpp: In function \xe2\x80\x98int main()\xe2\x80\x99:\ntemplates.cpp:26:19: error: template argument 1 is invalid\n std::vector<Foo*> flubs;\n ^\ntemplates.cpp:26:19: error: template argument 2 is invalid\nRun Code Online (Sandbox Code Playgroud)\n\n这是有问题的代码:
\n\n 1 #include <stdio.h>\n 2 #include <vector>\n 3 template <class T>\n 4 class Foo {\n 5 public:\n 6 virtual void f() const = 0;\n 7 };\n 8\n 9 class Bar : public Foo<Bar> {\n 10 public:\n 11 void f() const { printf("foobar\\n"); };\n 12 };\n 13\n 14 class Baz : public Foo<Baz> {\n …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 kotlin 中将 List 转换为 LinkedList,这是我的代码,其中包含来自 intellij 的错误
但在 Kotlin REPL 中我可以做这样的事情
我的代码有什么问题吗?
def Entekhab3_fun():
h = 0
Max = 1
while(h <= 10):
if(Montakhabha[h] == None):
break
elif(Montakhabha[h] > Max):
Max = Montakhabha[h]
elif(Montakhabha[h] == Max):
Max = Montakhabha[h]
else:
Max = Max
h += 1
return(Max)
Run Code Online (Sandbox Code Playgroud)
这是编译器引用的代码的一部分,我无法理解它的错误,但是当我编译它时,它说:
indexerror:列表索引超出范围
这是我的课
class ContainerStack{
public:
int getCapacity();
int getSize();
const Container& at(int height);
void take(Container aContainer);
Container give();
private:
std::vector<Container> containers();
};
Run Code Online (Sandbox Code Playgroud)
这是getCapacity()和getSize()方法
int ContainerStack::getCapacity(){
return containers.capacity();
}
int ContainerStack::getSize(){
return containers.size();
}
Run Code Online (Sandbox Code Playgroud)
GCC编译所有内容没有问题,但在使用Visual Studio 2017时,我得到一个E0153表达式必须有类类型错误.有任何解决这个问题的方法吗?
我正在做这个挑战,我在代码中使用这个 for 循环。
for (y >= i; y--;)
{
printf(" ");
}
Run Code Online (Sandbox Code Playgroud)
但我不断收到这个错误
mario.c:57:20: error: relational comparison result unused [-Werror,-Wunused-comparison]
for (y > i; y--;)
~~^~~
Run Code Online (Sandbox Code Playgroud)
唯一有效的技巧是在 for() 条件中创建一个无用的变量,但这将是无用的,只会占用空间。只有其他修复吗?
cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'gcc
Run Code Online (Sandbox Code Playgroud)
真诚地,我不知道为什么以及如何纠正这个问题。
#include <stdio.h>
#include <conio.h>
#include <string>
#include <vector>
namespace anas
{
void passwordGenerator()
{
std::vector<std::string> PasswordString;
std::string ElencoAlfabeto("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
char CharAlfabeto[ElencoAlfabeto.length()];
for (int Lettere_Create = 0; Lettere_Create < 8; Lettere_Create++)
{
int NumeroCarattere = rand() % sizeof(CharAlfabeto);
CharAlfabeto [NumeroCarattere] = ElencoAlfabeto[NumeroCarattere];
PasswordString.push_back(CharAlfabeto[NumeroCarattere]);
}
for (int Lettere_Scritte = 0; Lettere_Scritte < 8; Lettere_Scritte++)
{
printf ( PasswordString.at(Lettere_Scritte) );
}
}
}
int main()
{
system("cls");
std ::printf("the program is started... …Run Code Online (Sandbox Code Playgroud) 我想通过列表初始化来初始化作为 A 子类的类 B ( https://en.cppreference.com/w/cpp/language/list_initialization )
然而,它并不是这样工作的:
struct A {
int x;
};
struct B : public A {
};
int main()
{
A a{ 1 }; // compiles
B b{ 2 }; // doesn't compile
}
Run Code Online (Sandbox Code Playgroud)
有没有办法通过列表初始化来初始化 B 的实例?
本质上,我想在不声明任何构造函数的情况下初始化 B 的实例。
c++ inheritance compiler-errors aggregate list-initialization
compiler-errors ×10
c++ ×4
c ×2
cs50 ×2
for-loop ×2
loops ×2
python ×2
aggregate ×1
c++11 ×1
compilation ×1
delphi ×1
gcc ×1
generics ×1
inheritance ×1
kotlin ×1
linux ×1
overloading ×1
python-2.7 ×1
templates ×1
traceback ×1
ubuntu ×1
vector ×1