标签: compiler-errors

奇怪的C++错误:test.cpp:15:错误:将'const*'作为'*'的'this'参数传递丢弃限定符

我在使用特定的代码时遇到了一些问题,如果有人能够就此问题启发我,我将非常感激,我已经在以下示例中将问题排除在外:

#include <iostream>

using namespace std;

class testing{
   int test();
   int test1(const testing& test2);
};

int testing::test(){
   return 1;
}

int testing::test1(const testing& test2){
   test2.test();
   return 1;
}
Run Code Online (Sandbox Code Playgroud)

那么可能导致以下错误:

test.cpp:15:错误:将'const testing'作为'int testing :: test()'的'this'参数传递,丢弃限定符

非常感谢!

c++ compiler-errors const

43
推荐指数
2
解决办法
3万
查看次数

"预期类型"错误指向方法的返回类型

我试图编译,但每次我做,一个方法抛出一个奇怪的"预期的类型"错误.我在标题中有一个方法:

-(ANObject *)generateSomethingForSomethingElse:(NSString *)somethingElse;
Run Code Online (Sandbox Code Playgroud)

该方法的返回类型的错误点.我已经导入ANObject到标题使用#import "ANObject.h"ANObject正在编译精细..

为什么会这样?

xcode cocoa compiler-errors compilation objective-c

43
推荐指数
3
解决办法
6万
查看次数

编译C++项目中不使用预编译头文件的C文件?

我可以在C++项目中禁用.c文件的预编译头吗?

当我想将.C文件添加到我的程序中以获取C语言中的脚本虚拟/抽象机器时,我遇到了这些错误:

错误1错误C1853:'Release\pluginsa.pch'预编译头文件来自以前版本的编译器,或者预编译头是C++,您从C使用它(反之亦然)Z:\ Profile\Rafal\Desktop\samod\source\amx\amx.c 1 1 pluginsa

所有其他东西都是C++并使用我的预编译头.

c c++ compiler-errors precompiled-headers visual-c++

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

错误:任务执行失败':app:transformClassesWithJarMergingForDebug'

美好的一天.在AndroidStudio中更新谷歌存储库后,我遇到了问题

> Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry:
> android/support/v7/cardview/BuildConfig.class
Run Code Online (Sandbox Code Playgroud)

我试图从播放服务中排除组android.support,它没有帮助.当我在另一台PC上开始我的项目时,我有:

> Error:Execution failed for task  ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry:
> android/support/annotation/AnimRes.class
Run Code Online (Sandbox Code Playgroud)

我的build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "ru.alexeyk.myevents"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 16
        versionName "1.121"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile('com.github.nkzawa:socket.io-client:0.4.2') {
        exclude group: 'org.json', …
Run Code Online (Sandbox Code Playgroud)

android compiler-errors

43
推荐指数
6
解决办法
12万
查看次数

Xcode 8.0命令/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc失败,退出代码为1

当我在Xcode Version 8.0 beta 4(8S188o)上编译我的代码时,我遇到了这个错误,导致编译失败:

命令/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc失败,退出代码为1

我试图清理项目并擦除派生文件夹,但这并没有改变.它是什么,我怎么能知道更多呢?

当我尝试在终端上编译时,报告的错误是:

无效的bitcast \n%.asUnsubstituted = bitcast%swift.error*%13到i2,!dbg!438 \nLLVM错误:找到损坏的函数,编译中止!\n

xcode compiler-errors compilation ios xcode4

43
推荐指数
6
解决办法
7万
查看次数

getSupportFragmentManager().getFragments()显示编译时错误

调用getSupportFragmentManager().getFragments()显示编译时错误,并显示以下消息:

getSupportFragmentManager().getFragments()只能在同一个库组中调用(groupId = com.android.support)

我已导入以下类MainActivity:

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.MenuItem;
import android.widget.Toast;
Run Code Online (Sandbox Code Playgroud)

MainActivity延伸AppCompatActivity.

我的项目模块级build.gradle文件如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.mycompany.floatingdemo"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', …
Run Code Online (Sandbox Code Playgroud)

java android compiler-errors

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

"无法解决:com.android.support:support-v4:26.0.0"和Gradle同步上的其他类似错误

我刚刚为Android Mobile Wear 创建了一个新的Android Studio项目.初始gradle构建失败,因为我收到了几个错误 -

Error: Failed to resolve: com.android.support:support-v4:26.0.0

Error: Failed to resolve: com.android.support:percent:26.0.0

Error: Failed to resolve: com.android.support:recyclerview-v7:26.0.0

Error: Failed to resolve: com.android.support:support-annotations:26.0.0

对于每个错误,我都可以选择Install repository and sync project,但是当我点击它时没有任何反应.我花了几个小时试图找到我收到这些错误的原因,但我找不到任何解决方案.有谁知道如何解决这些非常令人沮丧的错误?谢谢!

build.gradle(项目)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they   belong
        // in the individual module …
Run Code Online (Sandbox Code Playgroud)

java android compiler-errors gradle wear-os

43
推荐指数
4
解决办法
5万
查看次数

'委托'System.Action'不带0个参数.' 这是一个C#编译器错误(lambdas +两个项目)吗?

请考虑以下代码.看起来完全有效的C#代码对吗?

//Project B
using System;
public delegate void ActionSurrogate(Action addEvent);
//public delegate void ActionSurrogate2();
// Using ActionSurrogate2 instead of System.Action results in the same error
// Using a dummy parameter (Action<double, int>) results in the same error

// Project A
public static class Class1 {
    public static void ThisWontCompile() {
        ActionSurrogate b = (a) =>
                            {
                                a(); // Error given here
                            };
    }
}
Run Code Online (Sandbox Code Playgroud)

我得到一个编译错误'委托'动作'不接受0参数.使用(Microsoft)C#4.0编译器在指定位置.请注意,您必须在另一个项目中声明ActionSurrogate才能显示此错误.

它变得更有趣:

// Project A, File 1
public static class Class1 {
    public static void ThisWontCompile() …
Run Code Online (Sandbox Code Playgroud)

c# lambda compiler-errors compiler-bug

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

为什么这个通用代码在java 8中编译?

我偶然发现了一段代码,让我想知道为什么它成功编译:

public class Main {
    public static void main(String[] args) {
        String s =  newList(); // why does this line compile?
        System.out.println(s);
    }

    private static <T extends List<Integer>> T newList() {
        return (T) new ArrayList<Integer>();
    }
}
Run Code Online (Sandbox Code Playgroud)

有趣的是,如果我修改方法的签名newList<T extends ArrayList<Integer>>它不工作了.

注释和响应后更新: 如果我将泛型类型从方法移动到类,则代码不再编译:

public class SomeClass<T extends List<Integer>> {
    public  void main(String[] args) {
        String s = newList(); // this doesn't compile anymore
        System.out.println(s);
    }

    private T newList() {
        return (T) new ArrayList<Integer>();
    }
}
Run Code Online (Sandbox Code Playgroud)

java generics compiler-errors java-8

42
推荐指数
3
解决办法
4254
查看次数

"EnsureBindingRedirects"任务意外失败

当我ASP.NET 4.5vs2012更新所有nuget包创建新的Web表单应用程序时,我在构建时收到此错误:

错误1"EnsureBindingRedirects"任务意外失败.System.NullReferenceException:未将对象引用设置为对象的实例.在在Microsoft.Build.BackEnd Roxel.BuildTasks.EnsureBindingRedirects.MergeBindingRedirectsFromElements(IEnumerable`1 dependentAssemblies)在Roxel.BuildTasks.EnsureBindingRedirects.Execute()在Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() .TaskBuilder.d__20.MoveNext()

.net compiler-errors asp.net-4.5 visual-studio-2012

41
推荐指数
4
解决办法
2万
查看次数