如何让Objective-C项目在Ubuntu上运行?
我的文件是:
Fraction.h
#import <Foundation/NSObject.h>
@interface Fraction: NSObject {
int numerator;
int denominator;
}
-(void) print;
-(void) setNumerator: (int) n;
-(void) setDenominator: (int) d;
-(int) numerator;
-(int) denominator;
@end
Run Code Online (Sandbox Code Playgroud)
Fraction.m
#import "Fraction.h"
#import <stdio.h>
@implementation Fraction
-(void) print {
printf( "%i/%i", numerator, denominator );
}
-(void) setNumerator: (int) n {
numerator = n;
}
-(void) setDenominator: (int) d {
denominator = d;
}
-(int) denominator {
return denominator;
}
-(int) numerator {
return numerator;
}
@end
Run Code Online (Sandbox Code Playgroud)
的main.m
#import <stdio.h>
#import …Run Code Online (Sandbox Code Playgroud) 大多数程序都适用于<4GB的地址空间,但需要使用x64架构上提供的新功能.
是否有编译器/平台,我可以使用x64寄存器和特定指令,但保留32位指针以节省内存?
是否可以透明地对遗留代码执行此操作?切换到底是做什么的?
要么
代码有什么变化,在保持32位指针的同时获得64位功能是必要的?
我在Emacs下编写OCaml,我makefile在工作文件夹中有一个,以及包含.ml文件的几个子文件夹.如果我在缓冲区上启动M-x compile并make正常工作makefile,但在.ml文件缓冲区上不起作用,则会给出错误:
-*- mode: compilation; default-directory: "..." -*-
Compilation started at Fri Jan 27 18:51:35
make -k
make: *** No targets specified and no makefile found. Stop.
Compilation exited abnormally with code 2 at Fri Jan 27 18:51:35
Run Code Online (Sandbox Code Playgroud)
这是可以理解的,因为default-directory是不包含的子文件夹makefile.有谁知道如何将makefilealways 的文件夹设置为编译的默认目录?
我试图在Centos 6.2上多次编译GnuTLS库,但没有运气.这些是步骤:
我下载了Nettle 2.4
[root@localhost opt]# wget http://www.lysator.liu.se/~nisse/archive/nettle-2.4.tar.gz
[root@localhost nettle-2.4]# tar zxvf nettle-2.4.tar.gz
[root@localhost nettle-2.4]# cd nettle-2.4
[root@localhost nettle-2.4]# ./configure --enable-shared --prefix=/usr
Version: nettle 2.4
Host type: x86_64-unknown-linux-gnu
ABI: 64
Assembly files: x86_64
Install prefix: /usr
Library directory: ${exec_prefix}/lib64
Compiler: gcc
Shared libraries: yes
Public key crypto: no
Run Code Online (Sandbox Code Playgroud)
我运行命令make和make install
我下载了最新的GnuTLS
./configure --with-libnettle-prefix=/usr
hecking for shared library run path origin... done
checking whether to use nettle... yes
checking for libnettle... no
configure: error:
***
*** Libnettle 2.4 …Run Code Online (Sandbox Code Playgroud) 我试图通过Emacs的编译模式编译u-boot,看起来Emacs不知道如何找到bash环境变量.即使我设置了它们,并且可以通过Emacs shell仿真进行编译,编译模式仍然会尝试编译,就好像它们不存在一样.
我需要做些什么来使其更具环保意识?
我正在使用Learning OpenCV学习OpenCV.
编译代码时我遇到的一个问题是我必须编写一个很长的命令来编译并获取可执行文件.
这是我正在使用的命令
g++ `pkg-config –cflags opencv` file_name.cpp -o output_file `pkg-config –libs opencv`
Run Code Online (Sandbox Code Playgroud)
我没有制作专家,但我想我可以消除写使用很长的命令作出.在此之前,我应该解释我的工作流程.我在我的主目录(~/opencv/)中创建了一个名为opencv的目录.我正逐节阅读本书,并将示例或练习编码到该目录中的新cpp源代码文件中.所以我不知道手头的文件名.
现在我想要做的是,
假设我编写了一个facedetect.cpp在我的opencv目录中命名的新文件,如果我调用make就像这样
make facedetect
Run Code Online (Sandbox Code Playgroud)
然后我想让make为我执行以下命令
g++ `pkg-config --cflags opencv` facedetect.cpp -o facedetect `pkg-config --libs opencv`
Run Code Online (Sandbox Code Playgroud)
所以每当我创建一个名为abc.cpp的新文件时,我都会执行make abc
以便我可以运行
$ ./abc
Run Code Online (Sandbox Code Playgroud)
在我的命令行测试我的abc.cpp
请给出make文件,这样我就可以省去每次输入那个长命令的挫败感.
PS:我用Google搜索的帮助就这个问题和发现这种使用CMake的,但我不明白是什么一样.还请解释如何使用CMake执行相同的任务.
我们有一个由众多应用程序组成的系统.所有应用程序的版本都同时更改.目前,当我们发布新版本时,我们必须手动打开每个应用程序的项目选项并逐个更改版本.有没有办法在同一版本上编译所有应用程序,例如,将其保存在全局文件中并在编译时,读取此文件并将该版本分配给项目?我只是想消除太多步骤,因为我们计划更频繁地更改版本号.我想在一个地方改变它.可以这样做吗?如何?
有谁知道如何将nodejs静态编译为单个可执行二进制文件?我的意思是不需要共享库.
旧版本nodejs有一些指南,但不适用于最后一个.
谢谢!
我在一个目录下的主程序包中有一些文件:
main.go config.go server.go
当我这样做:"去构建"程序构建完美,运行良好.当我这样做:"去运行main.go"它失败了.
输出:
# command-line-arguments
./main.go:7: undefined: Config
./main.go:8: undefined: Server
Run Code Online (Sandbox Code Playgroud)
未定义的符号是结构,它们是大写的,因此应该导出.
我的Go版本:go1.1.2 linux/amd64