标签: compilation

在开发过程中调试Firefox插件的最快方法

调试Firefox插件是一个缓慢的过程:(1)使用构建脚本将JS编辑器(2)包中的源代码编辑到XPI中(3)拖入Firefox安装(4)重启Firefox(5)打开JavaScript调试器

我们能否加快这一进程?比如在没有重启的情况下将其安装到Firefox中,或者配置构建脚本以将其安装到Firefox中?

debugging firefox compilation firefox-addon

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

如何防止非专业模板实例化?

我有一个模板化class(称之为Foo),它有几个特化.如果有人试图使用非专业版本,我希望编译失败Foo.

这是我实际拥有的:

template <typename Type>
class Foo
{
  Foo() { cannot_instantiate_an_unspecialized_Foo(); }

  // This method is NEVER defined to prevent linking.
  // Its name was chosen to provide a clear explanation why the compilation failed.
  void cannot_instantiate_an_unspecialized_Foo();
};

template <>
class Foo<int>
{    };

template <>
class Foo<double>
{    };
Run Code Online (Sandbox Code Playgroud)

以便:

int main()
{
  Foo<int> foo;
}
Run Code Online (Sandbox Code Playgroud)

适用时:

int main()
{
  Foo<char> foo;
}
Run Code Online (Sandbox Code Playgroud)

才不是.

显然,编译器链只在链接过程发生时才会抱怨.但有没有办法让它在之前抱怨?

我可以用boost.

c++ templates boost compilation

38
推荐指数
3
解决办法
5090
查看次数

PHP 5.4.7编译ext php_printer

我的知识库是,我可以在PHP中解决.我从未使用过C,C++,C#或任何编译器.

我从使用php 5.3的XAMPP 1.7.3升级到1.8.1,其中包括:Apache 2.4.3 MySQL 5.5.27 PHP 5.4.7

它安装在Windows 7 Pro,Windows XP Pro和Windows Server 2008 r2上.但我正试图让它在目前的Windows 7上工作.

我升级是因为出于安全原因我需要更新版本的Apache和MySQL.我没有降级选项.

我使用php_printer.dll将原始数据打印到打印机:

printer_set_option($handle, PRINTER_MODE, "RAW");
Run Code Online (Sandbox Code Playgroud)

我的代码在PHP 5.3中运行良好,但在PHP 5.4中打破了.

收到错误后:"致命错误:在〜"中调用未定义的函数printer_open().我检查了php_error_log并收到了以下信息.

PHP Warning: PHP Startup: printer: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
Run Code Online (Sandbox Code Playgroud)

我已经花了好几个小时试图找到PHP 5.4.7的预编译php_printer.dll无济于事.我得出结论,我将不得不从PECL中的源文件中编译它.pecl.php.net/package/printer

在我做任何互联网用户应该做的事之前,从来没有这样做过.我用Google搜索并在此处找到了一些信息:https: //wiki.php.net/internals/windows/stepbystepbuild

它花了我一整天,但PHP构建工作.但后来尝试创建php_printer.dll首先我试过:

svn co http://svn.php.net/repository/pecl/printer/trunk pecl/printer
Run Code Online (Sandbox Code Playgroud)

但它说:'svn'不被认为是内部或外部命令,可操作程序或批处理文件.

所以我只是自己从svn.php.net/repository/pecl/printer/trunk/下载文件 并将它们放入: C:\ php-sdk\php54dev\vc9\x86\php5.4-201303311430\ext\printer

我确保从以下网站下载这些库: windows.php.net/downloads/php-sdk/deps/vc9/x86/ 也只是: deps-5.4-vc9-x86.7z

然而,我尝试了另一个; 每当我尝试nmake时收到以下内容:

c:\php-sdk\php54dev\vc9\x86\php5.4-201303311430>nmake

Microsoft (R) Program Maintenance …
Run Code Online (Sandbox Code Playgroud)

php printing dll compilation

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

如何让IntelliJ IDEA识别由宏创建的代码?

背景

我有一个使用了SBT管理斯卡拉项目通常SBT项目布局斯卡拉用宏,即项目,包含宏的主要项目,是实际应用和依赖于宏观子项目子项目.宏是宏注释,实质上是为常规类生成伴随对象.生成的伴随对象在其他成员中声明了apply/unapply方法.

我使用sbt-idea插件生成相应的IntelliJ IDEA项目,并使用IDEA的sbt-plugin中的sbt控制台来编译和运行我的Scala应用程序.

一切都或多或少都有效,除了生成的伴随对象,更重要的是它们的成员,如apply/unapply,IDEA无法识别.因此,我在任何地方都得到了一条波浪线,例如,一种应用方法.

我的设置是IntelliJ IDEA CE 133.471,在Windows 7 x64上使用插件SBT 1.5.1和Scala 0.28.363.

问题

如何让IntelliJ IDEA识别由Scala宏生成的代码(类,对象,方法......)(准确地说是宏注释)?

是否已知其他IDE(例如Eclipse)在这样的设置中工作得更好?

有关

这个问题(不太详细)基本上问了同样的问题,但还没有得到答复(2014-02-26).

根据JetBrains开发人员说法,我要求的功能是他们的长期待办事项清单,但不会很快实施(2014-03-05).

compilation syntax-highlighting intellij-idea scala-macros

38
推荐指数
1
解决办法
2167
查看次数

确定C可执行文件名称

当我们编译C程序时,输出存储在a.out中.我们如何将编译后的输出重定向到另一个文件?

c executable gcc compilation linkage

37
推荐指数
5
解决办法
6万
查看次数

根据Visual Studio中的Debug/Release配置自动#defines

我的程序中有调试输出,如下所示:

#define DEBUG
...
#ifdef DEBUG
    std::cout << "[RE_words] " << m_re << std::endl;
#endif
Run Code Online (Sandbox Code Playgroud)

DEBUG在我的程序中手动定义.当我发布版本时,我总是注意到这一行.在Visual Studio中,还有用于调试发行版本的配置,它们处理用于编译的命令行等.我还可以使用配置"Debug"自动定义DEBUG到编译器吗?怎么样?

c++ compilation visual-studio-2010 visual-studio

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

Clojure是编译还是解释?

我在某处编写了Clojure.是真的编译,如Java或Scala,而不是解释,如Jython或JRuby?

interpreted-language compilation clojure jvm-languages compiled-language

37
推荐指数
3
解决办法
6250
查看次数

函数名称由编译器以下划线为前缀的原因是什么?

当我看到C应用程序的汇编代码时,如下所示:

emacs hello.c
clang -S -O hello.c -o hello.s
cat hello.s
Run Code Online (Sandbox Code Playgroud)

函数名称以下划线为前缀(例如callq _printf).为什么要这样做,它有什么优势?


例:

你好ç

#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main() {
  char *myString = malloc(strlen("Hello, World!") + 1);
  memcpy(myString, "Hello, World!", strlen("Hello, World!") + 1);
  printf("%s", myString);
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

hello.s

_main:                       ; Here
Leh_func_begin0:
    pushq   %rbp
Ltmp0:
    movq    %rsp, %rbp
Ltmp1:
    movl    $14, %edi
    callq   _malloc          ; Here
    movabsq $6278066737626506568, %rcx
    movq    %rcx, (%rax)
    movw    $33, 12(%rax)
    movl    $1684828783, 8(%rax)
    leaq    L_.str1(%rip), %rdi
    movq …
Run Code Online (Sandbox Code Playgroud)

c assembly naming compilation function

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

编译时错误"架构x86_64的未定义符号"是什么意思?

我正在尝试使用C++教科书中的示例中的相邻列表来编写图形类,当我使用此命令编译时:代码:g ++ -o prog program.cpp ...我收到以下错误:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

......这意味着什么?它可能会成为我的代码的一个问题,但我觉得它可能比这更深,因为我已经为几个不同的项目得到了同样看似莫名其妙的错误,其中许多项目以不同方式解决,不幸的是完全意外地.

我在某处读到它可能与我是使用32位还是64位库有关,并且可能需要使用标签-m32或-m64,但我不确定这是否适用于此.有趣的是,当我尝试添加-m64标记时,我得到了相同的确切错误,但是当我尝试使用-m32标记时,我得到了相同的错误,除了它说

Undefined symbols for architecture i386:
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

代替.

主要是我只想知道错误所说的世界是什么.我习惯于调试在代码中给出特定行等的编译时错误,但我无法从中识别出类似的内容.有任何想法吗?

如果它有所帮助,我将使用2008年末的Macbook和Intel Core 2 Duo(64位),而我正在运行OS X Lion(10.7.2),我认为这是最新版本.另外,我使用的是gcc 4.2.1版.

symbols compilation g++ undefined

37
推荐指数
1
解决办法
6万
查看次数

Xcode/Swift'文件名使用两次'构建错误

我是Swift的新手,在我(可能)通过CocoaPods正确安装第三方框架后,我正在努力解决错误.

错误如下.

<unknown>:0: error: filename "MainController.swift" used twice: '/Users/myname/Desktop/ProjectName/ProjectName/Controllers/MainController.swift' and '/Users/myname/Desktop/ProjectName/ProjectName/Controllers/MainController.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
Run Code Online (Sandbox Code Playgroud)

据我可以从其他论坛收集而且看似显而易见的是我必须删除两次使用的文件之一.但是我无法看到它们将被安装两次.如果我从/ Controllers文件夹中删除该文件,则错误将变为"找不到文件"等.

所以我的问题是,这些冲突的文件将在何处定位,如何安全地删除其中一个?或者更多的是,只有一个文件,但它被使用了两次 - 在这种情况下,我该如何阻止它?

非常感谢.


好的我觉得评论已经丢失所以我在这里澄清一下,看看是否可以触发一个答案,因为从昨天开始就无法构建和运行.

我现在只有Pods-> Pods/MainController文件夹中的swift文件.

当我构建时,我得到一个未找到的文件.但是它要查找的文件位于App-> Controllers文件夹中,这是我从中删除的文件.如果我把文件放在那里我得到'使用过两次'错误.

那么如何阻止它试图在控制器中找到该文件并在Pod中查找它?

谢谢

xcode compilation file ios swift

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