当前位置: 首页 > news >正文

网站建设功能需求/北京网站seo费用

网站建设功能需求,北京网站seo费用,建站报价,徐州最新情况最新消息今天Mac笔记本实在是贵,所以一直没舍得买,如此一来,就只能在我的Windows操作系统上学Objective-C了。安装GNUstepGNUstep Windows Installer提供了Windows平台下的Objective-C的模拟开发环境,一共有四个软件包,其中GNUstep…

Mac笔记本实在是贵,所以一直没舍得买,如此一来,就只能在我的Windows操作系统上学Objective-C了。

安装GNUstep

GNUstep Windows Installer提供了Windows平台下的Objective-C的模拟开发环境,一共有四个软件包,其中GNUstep System和GNUstep Core是必装的,GNUstep Devel和Cairo Backend是选装的。甭管必装选装,一次性全安上,免得以后麻烦。

编写Hello, World!

安装完成后,在开始菜单里的GNUstep选项里执行shell,就能打开命令行,在这里就可以使用vi编写Object-C程序了,不过操作起来总有些繁琐,其实也可以直接在Windows里进入C:\GNUstep\home\username目录,在这里用你喜欢的工具编写Object-C程序,然后再进入shell里编译。

直接给出helloworld.m文件内容,取自Programming in Objective-C 2.0一书:

#import <Foundation/Foundation.h>

int main (int argc, const char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Hello World!");
[pool drain];

return 0;
}


第一次编译:

gcc -o helloworld helloworld.m

结果出现错误信息,找不到头文件:

helloworld.m:1:34: Foundation/Foundation.h: No such file or directory
helloworld.m: In function `main':
helloworld.m:4: error: `NSAutoreleasePool' undeclared (first use in this function)
helloworld.m:4: error: (Each undeclared identifier is reported only once
helloworld.m:4: error: for each function it appears in.)
helloworld.m:4: error: `pool' undeclared (first use in this function)
helloworld.m:5: error: cannot find interface declaration for `NXConstantString'

第二次编译:

gcc -o helloworld helloworld.m \
-I /GNUstep/System/Library/Headers/

结果出现错误信息,找不到接口声明:

helloworld.m: In function `main':
helloworld.m:5: error: cannot find interface declaration for `NXConstantString'

第三次编译:

gcc -o helloworld helloworld.m \
-fconstant-string-class=NSConstantString \
-I /GNUstep/System/Library/Headers/

结果出现错误信息,找不到链接库:

helloworld.m:(.text+0x33): undefined reference to `_objc_get_class'
helloworld.m:(.text+0x45): undefined reference to `_objc_msg_lookup'
helloworld.m:(.text+0x64): undefined reference to `_objc_msg_lookup'
helloworld.m:(.text+0x80): undefined reference to `_NSLog'
helloworld.m:(.text+0x93): undefined reference to `_objc_msg_lookup'
helloworld.m:(.text+0xbc): undefined reference to `___objc_exec_class'
helloworld.m:(.data+0x74): undefined reference to `___objc_class_name_NSAutoreleasePool'
helloworld.m:(.data+0x78): undefined reference to `___objc_class_name_NSConstantString'
collect2: ld returned 1 exit status

第四次编译:

gcc -o helloworld helloworld.m \
-fconstant-string-class=NSConstantString \
-I /GNUstep/System/Library/Headers/ \
-L /GNUstep/System/Library/Libraries/ \
-lobjc \
-lgnustep-base

注意:helloworld.m必须出现在-lobjc和-lgnustep-base的前面,否则会出错。

此时会出现一些info提示信息,不过不碍事,终于成功了生成了可执行文件,执行./helloworld.exe看结果。

快捷方式:

如果每次使用gcc的时候,都要输入这么长的命令,无疑是很恼火的事儿,我们可以做一个快捷方式:

编辑C:\GNUstep\bin\gcc.sh的文件,内容如下:

#!/bin/sh

if [ $# -ne 1 ]; then
echo "Usage: $0 name"
exit 1
fi

gcc -g -o $1 $1.m \
-fconstant-string-class=NSConstantString \
-I /GNUstep/System/Library/Headers/ \
-L /GNUstep/System/Library/Libraries/ \
-lobjc \
-lgnustep-base

exit 0

其中,gcc加入了-g参数,方便gdb调试,使用时就很方便了,注意别带扩展名m:

gcc.sh helloworld

参考链接:Compile Objective-C Programs Using gcc

来自:http://hi.baidu.com/thinkinginlamp/blog/category/c%20%26%2347%3B%20objective-c

转载于:https://www.cnblogs.com/AlexLiu/archive/2009/10/10/1580200.html

http://www.lbrq.cn/news/766675.html

相关文章:

  • 网站搭建者/网站查询备案信息
  • 做平面的素材网站/网络营销的手段有哪些
  • 温州做网站优化/高端企业网站定制公司
  • 上海徐汇网站建设公司/如何做免费网站推广
  • 网站标题作弊详解/推广网站的公司
  • 可以做样机图的网站/黄冈网站推广策略
  • 营销计划书/杭州网站seo外包
  • 深圳附近做个商城网站找哪家公司好/网站优化推广平台
  • 用php做网站的实训日志总结/2024年3月份病毒会爆发吗
  • 手机网站用什么软件/seo是什么岗位
  • 如何与导航网站做友情链接/seo发包排名软件
  • 网站自己做服务器划算吗/指数函数求导公式
  • 桂林网站开发m0773/网站建设的意义和作用
  • 动态网站开发工程师 asp/郑州seo外包v1
  • 如何做自己的网站表白/开发网站多少钱
  • 自己做的网站怎么调用百度地图/广州百度快速优化排名
  • 织梦 图片网站/百度搜索推广怎么做
  • 网站地图后缀/百度手机助手网页版
  • 做网站交互demo工具/品牌整合推广
  • 自己做网站翻译服务器 - 添加网站/关键词优化收费标准
  • 高新快速建设网站找哪家/自己创建网页
  • 做网站如何找客户/怎么创建自己的网站平台
  • 沈阳和平三好街做网站/nba最新交易动态
  • 企业宣传网站多大主机/点击宝seo
  • 学院网站建设项目WBS/成都网站建设团队
  • 酒水销售网站模板/谷歌seo优化技巧
  • 公司门户网站怎么做/seo引擎优化服务
  • 小型企业网站开发公司/网络营销策略包括
  • 网站购物功能如何做/南宁seo费用服务
  • 网站建设是/东莞关键词优化平台
  • PostgreSQL 免安装
  • 上网行为安全概述和组网方案
  • 嵌入式第二十七天(UI相关技术(framebuffer))
  • 《算法导论》第 22 章 - 基本的图算法
  • Query通过自注意力机制更新(如Transformer解码器的自回归生成)的理解
  • 【C#】利用数组实现大数数据结构