标签: compiler-errors

安装python时在$ PATH中找不到可接受的C编译器

我正在尝试在我的共享主机上安装新的python环境.我按照这篇文章中的步骤进行操作:

mkdir ~/src
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
tar -zxvf Python-2.7.1.tar.gz
cd Python-2.7.1
mkdir ~/.localpython
./configure --prefix=/home/<user>/.localpython
make
make install
Run Code Online (Sandbox Code Playgroud)

在进入"./configure --prefix =/home // .localpython"命令后,我得到以下输出:

checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux3
checking EXTRAPLATDIR... 
checking machine type as reported by uname -m... x86_64
checking for --without-gcc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home3/mikos89/Python-2.7.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details. …
Run Code Online (Sandbox Code Playgroud)

python compiler-errors virtualenv

201
推荐指数
11
解决办法
37万
查看次数

Swift类中的错误:在super.init调用时未初始化属性

我有两节课,ShapeSquare

class Shape {
    var numberOfSides = 0
    var name: String
    init(name:String) {
        self.name = name
    }
    func simpleDescription() -> String {
        return "A shape with \(numberOfSides) sides."
    }
}

class Square: Shape {
    var sideLength: Double

    init(sideLength:Double, name:String) {
        super.init(name:name) // Error here
        self.sideLength = sideLength
        numberOfSides = 4
    }
    func area () -> Double {
        return sideLength * sideLength
    }
}
Run Code Online (Sandbox Code Playgroud)

通过上面的实现,我得到错误:

property 'self.sideLength' not initialized at super.init call
    super.init(name:name)
Run Code Online (Sandbox Code Playgroud)

为什么我必须self.sideLength在打电话前设置super.init

compiler-errors properties swift

201
推荐指数
9
解决办法
10万
查看次数

必须在非泛型静态类中定义扩展方法

我收到错误:

必须在非泛型静态类中定义扩展方法

在线上:

public class LinqHelper
Run Code Online (Sandbox Code Playgroud)

这是基于Mark Gavells代码的助手类.我真的很困惑这个错误意味着什么,因为我确信它在周五离开时工作正常!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Linq.Expressions;
using System.Reflection;

/// <summary>
/// Helper methods for link
/// </summary>
public class LinqHelper
{
    public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> source, string property)
    {
        return ApplyOrder<T>(source, property, "OrderBy");
    }
    public static IOrderedQueryable<T> OrderByDescending<T>(this IQueryable<T> source, string property)
    {
        return ApplyOrder<T>(source, property, "OrderByDescending");
    }
    public static IOrderedQueryable<T> ThenBy<T>(this IOrderedQueryable<T> source, string property)
    {
        return ApplyOrder<T>(source, property, "ThenBy");
    }
    public static IOrderedQueryable<T> ThenByDescending<T>(this IOrderedQueryable<T> …
Run Code Online (Sandbox Code Playgroud)

.net c# linq extension-methods compiler-errors

198
推荐指数
8
解决办法
28万
查看次数

奇怪的链接错误:命令行中缺少DSO

当我编译openvswitch-1.5.0时,我遇到了以下编译错误:

 gcc -Wstrict-prototypes -Wall -Wno-sign-compare -Wpointer-arith
     -Wdeclaration-after-statement -Wformat-security -Wswitch-enum -Wunused-parameter -Wstrict-aliasing -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -Wno-override-init  -g -O2 -export-dynamic ***-lpthread***  -o utilities/ovs-dpctl utilities/ovs-dpctl.o lib/libopenvswitch.a
 /home/jyyoo/src/dpdk/build/lib/librte_eal.a
 /home/jyyoo/src/dpdk/build/lib/libethdev.a
 /home/jyyoo/src/dpdk/build/lib/librte_cmdline.a
 /home/jyyoo/src/dpdk/build/lib/librte_hash.a
 /home/jyyoo/src/dpdk/build/lib/librte_lpm.a
 /home/jyyoo/src/dpdk/build/lib/librte_mbuf.a
 /home/jyyoo/src/dpdk/build/lib/librte_ring.a
 /home/jyyoo/src/dpdk/build/lib/librte_mempool.a
 /home/jyyoo/src/dpdk/build/lib/librte_malloc.a -lrt -lm 
     /usr/bin/ld: /home/jyyoo/src/dpdk/build/lib/librte_eal.a(eal.o): undefined reference
     to symbol 'pthread_create@@GLIBC_2.2.5'
     /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from 
     command line
Run Code Online (Sandbox Code Playgroud)

如果我试着看到它的符号libpthread,它看起来很好.

$ readelf -s /lib/x86_64-linux-gnu/libpthread.so.0 | grep pthread_create
   199: 0000000000008220  2814 FUNC    GLOBAL DEFAULT   13 pthread_create@@GLIBC_2.2.5
   173: 0000000000008220  2814 FUNC    LOCAL  DEFAULT   13 __pthread_create_2_1
   462: …
Run Code Online (Sandbox Code Playgroud)

linker gcc compiler-errors undefined-reference

188
推荐指数
7
解决办法
40万
查看次数

如何在IntelliJ中查看编译错误列表?

我正在寻找一种方法来查看IntelliJ中的所有编译错误,类似于它们在Eclipse中的显示方式.我尝试在这里和谷歌搜索,但还没有真正找到解决方案.我真的很喜欢IntelliJ,我最近从Eclipse转换到它,我希望这只是我缺少的东西,而不是一个根本的缺陷.

java compiler-errors intellij-idea

164
推荐指数
3
解决办法
10万
查看次数

升级到 JDK 21 后出现编译错误 - “NoSuchFieldError: JCImport does not have member field JCTree qualid”

升级到JDK 21后,我的Spring Boot项目出现以下编译错误:

Fatal error compiling: java.lang.NoSuchFieldError:
Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'
Run Code Online (Sandbox Code Playgroud)

compiler-errors upgrade lombok spring-boot java-21

150
推荐指数
2
解决办法
12万
查看次数

为什么我可以将1作为短路,而不是int变量i?

为什么第一个和第二个写入工作但不是最后一个?有没有办法我可以允许所有3个并检测它是1,(int)1还是我传入?真的为什么一个允许但最后一个?第二个被允许但不是最后一个真的让我大吃一惊.

演示显示编译错误

using System;
class Program
{
    public static void Write(short v) { }
    static void Main(string[] args)
    {
        Write(1);//ok
        Write((int)1);//ok
        int i=1;
        Write(i);//error!?
    }
}
Run Code Online (Sandbox Code Playgroud)

c# int compiler-errors type-conversion implicit-conversion

147
推荐指数
4
解决办法
5996
查看次数

C#错误:Parent不包含带0参数的构造函数

我的代码是

public class Parent
{

    public Parent(int i)
    {
        Console.WriteLine("parent");
    }
}

public class Child : Parent
{
    public Child(int i)
    {
        Console.WriteLine("child");
    }

}
Run Code Online (Sandbox Code Playgroud)

我收到错误:

Parent不包含带0参数的构造函数.

我理解问题是Parent没有带0参数的构造函数.但我的问题是,为什么我们需要一个零参数的构造函数?没有它,为什么代码不工作?

c# inheritance constructor compiler-errors

141
推荐指数
4
解决办法
10万
查看次数

Swift编译器错误:字符串连接上的"表达式太复杂"

我觉得这比任何事都更有趣.我修好了,但我想知道原因.这是错误:DataManager.swift:51:90: Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions.为什么抱怨?这似乎是最简单的表达方式之一.

编译器指向该columns + ");";部分

func tableName() -> String { return("users"); } 

func createTableStatement(schema: [String]) -> String {

    var schema = schema;

    schema.append("id string");
    schema.append("created integer");
    schema.append("updated integer");
    schema.append("model blob");

    var columns: String = ",".join(schema);

    var statement = "create table if not exists " + self.tableName() + "(" + columns + ");";

    return(statement);
}
Run Code Online (Sandbox Code Playgroud)

修复是:

var statement = "create …
Run Code Online (Sandbox Code Playgroud)

xcode functional-programming compiler-errors ios swift

139
推荐指数
3
解决办法
4万
查看次数

"对模板类构造函数的未定义引用

我不知道为什么会发生这种情况,因为我认为我已经正确地声明和定义了所有内容.

我有以下程序,使用模板设计.这是一个简单的队列实现,其成员函数为"add","substract"和"print".

我已经在精细的"nodo_colaypila.h"中为队列定义了节点:

#ifndef NODO_COLAYPILA_H
#define NODO_COLAYPILA_H

#include <iostream>

template <class T> class cola;

template <class T> class nodo_colaypila
{
        T elem;
        nodo_colaypila<T>* sig;
        friend class cola<T>;
    public:
        nodo_colaypila(T, nodo_colaypila<T>*);

};
Run Code Online (Sandbox Code Playgroud)

然后在"nodo_colaypila.cpp"中实现

#include "nodo_colaypila.h"
#include <iostream>

template <class T> nodo_colaypila<T>::nodo_colaypila(T a, nodo_colaypila<T>* siguiente = NULL)
{
    elem = a;
    sig = siguiente;//ctor
}
Run Code Online (Sandbox Code Playgroud)

然后,队列模板类的定义和声明及其功能:

"cola.h":

#ifndef COLA_H
#define COLA_H

#include "nodo_colaypila.h"

template <class T> class cola
{
        nodo_colaypila<T>* ult, pri;
    public:
        cola<T>();
        void anade(T&);
        T saca();
        void print() const;
        virtual …
Run Code Online (Sandbox Code Playgroud)

c++ templates compiler-errors codeblocks

136
推荐指数
3
解决办法
11万
查看次数