跳至正文

compileonly

如何解决No architectures to compile for ONLY

如何解决No architectures to compile for ONLY

解决方法(可以依次尝试,总有一种能最终解决问题):

方法1.退出Xcode,然后从finder里面进入~/Library/Developer/Xcode/DerivedData 删掉里面所有的内容,然后重启Xcode试试看

方法2.上面的操作也可以直接在Xcode的organizer中完成,在organizer里面切换到projects,然后delete掉derived data

在target设置中删掉Prefix Header的值,重启Xcode试试看

最后恢复Prefix Header的设置

方法3:

还是在Xcode里面

项目-targets-build phases,

然后从copy bundle resources里面删掉红色的错误资源文件

另外解决方式

No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=armv7, VA

运行报错

出现的原因:armv7s是应用在iPhone 5 A6 的架构上的

解决的方式:

1,在Project target里“Architectures”设置为“Standard (armv7,armv7s)”

2,修改在Project target里“Build Settings”的“Valid Architectures”添加“i386”和“armv7”(Xcode4.6 以上版本不再支持armv6,请去掉)

3,设置”Build Active Architecture Only”为“NO”。这样你build你的项目的时候就能在iphoe5和iphoe4s里执行。

java Eclipse编译错误,Error:can only compile one java file a time,求解释,在线等急,分全给

java Eclipse编译错误,Error:can only compile one java file a time,求解释,在线等急,分全给

怀疑你的源文件有问题,打开看看吧,比如一个文件中不应该出现多个 public class.

通过几个简单的Linux命令,深入理解c语言编

通过几个简单的Linux命令,深入理解c语言编

主要使用gcc命令以及以下几个参数:

-E Preprocess only; do not compile, assemble or link

-S Compile only; do not assemble or link

-c Compile and assemble, but do not link

-o Place the output into

环境配置好以后,让我们开始c语言的编译之旅吧~

编写c语言源代码

很多linux命令都可以新建一个文件,比如

$ touch test.c

建立一个空白的文件

$ vim test.c

使用vim(文本编辑器)编辑test.c,如果test.c不存在,则创建

$ echo “123” > test.c

通过输出重定向新建一个文件

创建完test.c后,将下面这段Hello World代码写到test.c中(很多方法)

#include

int main(){

printf(“Hello world\n”);

return 0;

}

写完之后可以使用ls命令来查看当前目录下的文件,检查test.c是否存在

$ ls

使用cat命令查看test.c中的内容,检查是否写入成功

$ cat test.c

ls-cat

展开头文件(预处理)

$ gcc -E test.c -o test_pre.c

这个命令把源代码test.c中的头文件展开,并把结果输出到test_pre.c

(可以使用cat或者vim命令查看test_pre.c文件中的内容)

per

test_pre.c中的内容是这样的,可以发现原本几行的代码变成了几百行,而且已经见不到include关键字了,取而代之的是一些变量定义的代码,这些代码就是stdio.h中的内容,和stdio.h中头文件展开后的内容。

编译

$ gcc -S test_pre.c -o test_asm.s

这一条命令将上一步预处理过后的源代码编译成为汇编代码

asm

现在看到的是test_asm.s里面的汇编代码。

什么是汇编?

汇编语言是汇编指令集、伪指令集和使用它们规则的统称,使用具有一定含义的符号为助忆符,用指令助忆符、符号地址等组成的符号指令称为汇编格式指令。

简单的可以理解为汇编语言是一本词典,01100101011010这样的二进制字符串是单词,汇编指令是单词的含义。计算机能读懂二进制字符串,而人能读懂的是翻译过来的汇编指令。

汇编

$ gcc -c test_asm.s -o test_obj.o

这一步将test_asm.s汇编成为目标文件,目标文件中存储的就是010101010这样的字符串了,可以用cat命令试试去读取test_obj.o

obj

可以发现打印出来许多不可见的字符,原因是目标文件已经是二进制格式的了,不同于源代码(文本格式)

有关文件的格式可以看下这里的介绍:

http://www.cnblogs.com/zhangjiankun/archive/2011/11/27/2265184.html

链接

链接器负责将程序的目标文件与所需的所有附加的目标文件连接起来,最终生成可执行文件。附加的目标文件包括静态连接库和动态连接库。

这个例子中没有附加的目标文件,所以只需要目标文件做被链接的对象。

有关链接器的详细讲解大家可以看下这里:

https://www.zhihu.com/question/27386057

$ gcc test_obj.o -o hello

gcc本身可以充当链接器,这里使用gcc命令将目标文件test_obj.o链接成了可执行文件hello

ld

运行程序!

至此,源代码已经经历了预处理、编译、汇编、链接四步成为了可执行文件,现在试着运行一下这个程序吧

$ ./hello

hello

小结

首先我们创建了源文件test.c,然后用gcc -E将源文件中的头文件展开,这一步叫做预处理;

之后通过gcc -S将预处理后的源文件编译了汇编代码,这一步叫做编译;

接着使用gcc -c命令将汇编代码转换成了二进制的目标文件,这一步操作叫做汇编;

目标文件不同于源代码,是二进制格式,是源文件编译过程中产生的中间文件,通过链接器可以将多个目标文件链接成为可执行文件,这一步叫做链接。

源文件->(预处理->编译->汇编->链接)->可执行文件

一般大家所说的c语言编译,其实是上述这四步的简称。

请大家帮帮忙翻译一下?有点长..

Slowly pale to your all attachments, pale to your all sentiments, I will start my new life absorbed absorbed.because I no longer looked like formerly equally do not have the courage, was not again that coward. I will go to seek for my happiness, look compared to you love me, will sympathize me the person.because I have this ability, I will not put myself again. I start to understand finally that compromises for the general interest, actually is only pays lip service, nobody will achieve radically, these, only will be the rumors which the people will compile. actually, forgot that is the best method.

翻译一下这段英文?

未知副词 Barstuck未知 BuildingPlop打开窗户的位置,你可以选择在每幢房子,一为这个游戏作弊或者放置好测试蝙蝠 美国华盛顿州动物园的鬼魂出现在公墓的许多 控制器未知 CreateException坠毁比赛(小心啊!) DollyLlama变化顾问的脸骆驼 DrawPaths显示自动机网络项目路径,可以用来南调试 效果未知 FPS(数值

国外PHP空间怎么获取web页?

allow_url_fopen booleanThis option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of remote files using the ftp or http protocol, some extensions like zlib may register additional wrappers.Note:This option was introduced immediately after the release of version 4.0.3. For versions up to and including 4.0.3 you can only disable this feature at compile time by using the configuration switch –disable-url-fopen-wrapper.WarningOn Windows versions prior to PHP 4.3.0, the following functions do not support remote file accessing: include, include_once, require, require_once and the imagecreatefromXXX functions in the GD and Image Functions extension.

高手指教一下,为什么这段代码提交后老是compile error

#include

#include

#include

#include

using namespace std;

int main()

{

//fstream cin(“e:\\1\\1.txt”);

map cimap;

int line;

cin>>line;

string str;

for(int i = 0; i!=line; ++i)

{

cin>>str;

for(string::iterator it = str.begin(); it!=str.end(); ++it)

{

++cimap[*it];

}

int len = cimap.size();

for(map::iterator jt = cimap.begin(); jt!=cimap.end(); ++jt)

{

jt->second==1? cout<first : cout<second<first;

}

cimap.clear();

cout<<'\n';

}

return 0;

}

Input

The first line contains an integer N (1 <= N <= 100) which indicates the number of test cases. The next N lines contain N strings. Each string consists of only 'A' - 'Z' and the length is less than 100.

Output

For each test case, output the encoded string in a line.

Sample Input

2

ABC

ABBCCC

Sample Output

ABC

A2B3C

谁能帮我讲下this指针

In MSDN:

The this pointer is a pointer accessible only within the nonstatic member functions of a class, struct, or union type. It points to the object for which the member function is called. Static member functions do not have a this pointer.

this 指针指向类的当前实例。静态成员函数没有 this 指针。

一个对象的this指针不是对象本身的一部分,它不反映在对象sizeof表达式的结果里。当一个对象的非静态成员函数被调用时,编译器将对象的地址隐式的赋给函数。例如下面的函数调用

myDate.setMonth( 3 );

可能被解释成:

setMonth( &myDate, 3 );

在函数内部,对象的地址已this指针的方式被使用。多数this的使用时隐式的。显式的使用this引用类的成员,是合法的,不必要的。例如:

void Date::setMonth( int mn ) {

month = mn; // 这三个语句是等价的

this->month = mn; //

(*this).month = mn;

}

this指针通常在成员函数需要返回当前对象使使用。

return *this;

this指针也可以用于防止自引用(self-reference),在类的赋值函数里。

if (&Object != this) {

// do not execute in cases of self-reference

this指针是不能修改的,给this复制是不允许的。

// this_pointer.cpp

// compile with: /EHsc

#include #include using namespace std; class Buf { public: Buf( char* s ); Buf& operator=( const Buf & ); void Display() { cout << buffer << endl; } private: char* buffer; }; Buf::Buf( char* s ) { buffer = new char[ strlen( s ) + 1 ]; strcpy( buffer, s ); } Buf::~Buf(){ if(NULL != this->buf) { delete this->buf; this->buf = NULL; } } // 类的赋值函数 Buf& Buf::operator=( const Buf &otherbuf ) { if( &otherbuf != this ) { // 防止自引用 delete [] buffer; buffer = new char[ strlen( otherbuf.buffer ) + 1 ]; strcpy( buffer, otherbuf.buffer ); } return *this; } int main() { Buf myBuf( “my buffer” ); Buf yourBuf( “your buffer” ); myBuf.Display(); myBuf = yourBuf; myBuf.Display(); myBuf = myBuf; // 调用Buf& Buf::operator=( const Buf &otherbuf ) // if语句将判断为假,直接return *this } Output my buffer your buffer

linux下pidgin里怎么上QQ呢?

去Ubuntu论坛里下载8月11号发布的pidgin-lwqq,编译安装.我用了几天,挺好用的,没有libqq那种冻结帐号的情况. 以下是开发者说的:12-08-11:修正群聊天crash 修正图片上传crash 增加提示信息 目前实现了 好友文字聊天.群文字聊天 发送接受图片.接受表情.支持好友头像.empathy可用.最关键的是支持gnome3的背景聊天功能.(使用empathy时)

请翻译如下内容

(4)它是使消防档案材料化为消防档案的重要条件之一。未经整理的、零散的消防档案材料,只能是构成消防档案的因素,而不是科学意义的档案。

(4) It is one of the important conditions to transform fire fighting materials into fire fighting archives. Fire archives haven’t been managed and scattered can only be the factors to constitute fire files, rather than the files with scientific significance.