标签: compilation

node_modules/@types/node/index.d.ts(20,1): 错误 TS1084: 无效的“引用”指令语法

我有打字稿编译的问题。smbd 遇到过吗?

node_modules/@types/node/index.d.ts(20,1): 错误 TS1084: 无效的“引用”指令语法。

tsconfig.json:

{
    "compileOnSave": false,
    "compilerOptions": {
        "sourceMap": true,
        "outDir": "./dist",
        "rootDir": "./app",
        "target": "es6",
        "module": "commonjs",
        "declaration": false,
        "noImplicitAny": false,
        "removeComments": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "listFiles": false,
        "skipLibCheck": true
    },
    "include": [
        "./app/**/*.ts"
    ]
}
Run Code Online (Sandbox Code Playgroud)

package.json 中的打字稿版本: "typescript": "^2.6.1"

compilation node.js typescript tsconfig

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

XAML条件编译

有没有一种简单的方法可以在我的xaml文件中使用我用于c#代码的相同条件编译符号?

c# xaml conditional compilation

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

为什么我的程序在最终类变量未初始化时不显示编译时错误?

对于以下代码:

public class StaticFinal
{
    private final static int i ;
    public StaticFinal()
    {}
}
Run Code Online (Sandbox Code Playgroud)

我得到编译时错误:

StaticFinal.java:7: variable i might not have been initialized
        {}
         ^
1 error
Run Code Online (Sandbox Code Playgroud)

这符合JLS8.3.1.2,其中说:

如果空白的final(§4.12.4)类变量未被声明它的类的静态初始化程序(第8.7节)明确赋值(第16.8节),则为编译时错误.

所以,完全理解上述错误.
但现在考虑以下内容:

public class StaticFinal
{
    private final static int i ;
    public StaticFinal()throws InstantiationException
    {
        throw new InstantiationException("Can't instantiate"); // Don't let the constructor to complete.
    }
}
Run Code Online (Sandbox Code Playgroud)

这里,构造函数永远不会完成,因为它InstantiationException是在构造函数的中间抛出的.这段代码编译得很好!!
为什么?为什么这段代码没有显示关于final变量非初始化的编译时错误i


编辑
我正在使用javac 1.6.0_25命令提示符编译它(不使用任何IDE)

java static final compilation class-variables

30
推荐指数
1
解决办法
1755
查看次数

什么是gcc中的-ffreestanding选项?

什么是ffreestandinggcc?它是干什么用的 ?我遇到了以下情况:

gcc -ffreestanding -m32 -c kernel.c -o kernel.o
Run Code Online (Sandbox Code Playgroud)

并且不明白,它究竟意味着什么.

c gcc compilation

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

如何使Visual Studio使用本机amd64工具链

如何让Visual Studio 2012使用本机amd64工具链,而不是默认的x86_amd64交叉编译器?

我正在构建一个大型库,在进行整个程序优化和链接时代码生成时会导致链接器内存不足.

我找到两个较旧的帖子(这里这里)提出同样的问题,但还没有答案.Microsoft提供了有关如何在命令行上指定工具链但不在IDE中指定工具链的文档.

c++ 64-bit compilation visual-studio

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

编译Python 3.4不是复制pip

我已经从Linux Mint的源代码编译了Python 3.4,但由于某种原因它没有复制pip到它的最终编译文件夹(之后make install).

有任何想法吗?

python compilation pip python-3.4

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

Visual Studio代码:编译typescript模块

我刚刚下载了新的Visual Studio Code,我的第一印象非常积极.对于打字稿,intellisense工作得很漂亮.

但是,有一个奇怪的问题:VS Code似乎无法编译typescript模块.

这段代码:

/// <reference path="../definitions/react.d.ts"/>

import React = require("react");
Run Code Online (Sandbox Code Playgroud)

在cmd上编译完全正常

tsc --module commonjs main.ts

但在VS Code中,第二行以红色突出显示,编辑抱怨:

除非提供"-module"标志,否则无法编译外部模块

当然,任何使用模块的打字稿代码都必须使用此标志进行编译.但是如果IDE知道模块的用法,为什么不设置标志呢?没有模块的打字稿代码在保存时编译,没有问题.

我想我错过了一些编译器设置配置文件.有这样的事吗?我在哪里可以找到它?

UPDATE

我添加了tsconfig.json文件:

{
    "compilerOptions": {
        "target": "ES5",
        "module": "commonjs",
        "sourceMap": true
    }
}
Run Code Online (Sandbox Code Playgroud)

这实际上消除了错误.不幸的是,IDE不再编译我的代码.起初我以为config.json只会使错误消息静音,但它确实不止于此.Intellisense现在可以在示例文件中使用.如果我键入React自动完成被触发并且显然知道React,因为显示了有意义的建议.

现在,为什么VS Code没有将文件编译为js?我已经尝试配置任务运行器来完成这项工作,但它似乎不起作用:

{
    "version": "0.1.0",

    // The command is tsc.
    "command": "tsc",

    // Show the output window only if unrecognized errors occur. 
    "showOutput": "silent",

    // Under windows use tsc.exe. This ensures we don't need a shell.
    "windows": {
        "command": "tsc.exe"
    }, …
Run Code Online (Sandbox Code Playgroud)

compilation typescript visual-studio-code

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

有没有办法在Perl中预编译正则表达式?

有没有办法在Perl中预编译正则表达式?我有一个在程序中多次使用它并且它在使用之间没有变化.

regex perl compilation

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

如何提高Golang编译速度?

我正试图找到一种方法来更快地编译Go程序.目前大约30秒,这使得项目工作变得缓慢.

当我运行时go build -v,我发现大部分时间都花在编译go-sqlite3(链接到C sqlite lib)上.但是,由于这个lib永远不会改变,我想知道是否有可能阻止构建工具每次都重新编译它?

sqlite performance compilation go

29
推荐指数
1
解决办法
6558
查看次数

为什么C++链接器允许未定义的函数?

可能令人惊讶的是,这个C++代码打印出来1.

#include <iostream>

std::string x();

int main() {

    std::cout << "x: " << x << std::endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

x 是一个函数原型,它似乎被视为一个函数指针,而C++标准部分4.12布尔转换说:

4.12布尔转换[conv.bool] 1算术,无范围枚举,指针或指向成员类型的指针的prvalue可以转换为bool类型的prvalue.零值,空指针值或空成员指针值转换为false; 任何其他值都转换为true.对于直接初始化(8.5),std :: nullptr_t类型的prvalue可以转换为bool类型的prvalue; 结果值为false.

但是,x永远不会绑定一个函数.正如我所料,C链接器不允许这样做.但是在C++中,这根本不是问题.谁能解释这种行为?

c++ linker compilation language-lawyer undefined-function

29
推荐指数
3
解决办法
1680
查看次数