,安装gcc
debian-dk:~# apt-get install gcc
正在读取软件包列表… 完成
正在分析软件包的依赖关系树… 完成
将会安装下列额外的软件包:
gcc-4.1 libssp0
建议安装的软件包:
manpages-dev autoconf automake1.9 libtool flex bison gcc-doc gcc-4.1-doc
gcc-4.1-locales libc6-dev-amd64 lib64gcc1 lib64ssp0
推荐安装的软件包:
libc6-dev libc-dev libmudflap0-dev
下列【新】软件包将被安装:
gcc gcc-4.1 libssp0
共升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 0 个软件未被升级 。
需要下载 0B/470kB 的软件包。
解压缩后会消耗掉 1401kB 的额外空间。
您希望继续执行吗?[Y/n]y
选中了曾被取消选择的软件包 libssp0。
(正在读取数据库 … 系统当前总共安装有 52968 个文件和目录。)
正在解压缩 libssp0 (从 …/libssp0_4.1.1-21_i386.deb) …
选中了曾被取消选择的软件包 gcc-4.1。
正在解压缩 gcc-4.1 (从 …/gcc-4.1_4.1.1-21_i386.deb) …
选中了曾被取消选择的软件包 gcc。
正在解压缩 gcc (从 …/gcc_4.1.1-15_i386.deb) …
正在设置 libssp0 (4.1.1-21) …
正在设置 gcc-4.1 (4.1.1-21) …
正在设置 gcc (4.1.1-15) …
3,查看gcc信息,看是否安装好
debian-dk:~# man gcc
No manual entry for gcc
See ‘man 7 undocumented’ for help when manual pages are not available.
debian-dk:~# ls
debian-dk:~# find -name gcc
debian-dk:~# gcc –help
Usage: gcc [options] file…
Options:
-pass-exit-codes Exit with highest error code from a phase
–help Display this information
–target-help Display target specific command line options
(Use ‘-v –help’ to display command line options of sub-processes)
-dumpspecs Display all of the built in spec strings
-dumpversion Display the version of the compiler
-dumpmachine Display the compiler’s target processor
-print-search-dirs Display the directories in the compiler’s search path
-print-libgcc-file-name Display the name of the compiler’s companion library
-print-file-name=
-print-prog-name=
-print-multi-directory Display the root directory for versions of libgcc
-print-multi-lib Display the mapping between command line options and
multiple library search directories
-print-multi-os-directory Display the relative path to OS libraries
-Wa,
-Wp,
-Wl,
-Xassembler
-Xpreprocessor
-Xlinker
-combine Pass multiple source files to compiler at once
-save-temps Do not delete intermediate files
-pipe Use pipes rather than intermediate files
-time Time the execution of each subprocess
-specs=
-std=
–sysroot=
for headers and libraries
-B
-b
-V
-v Display the programs invoked by the compiler
-### Like -v but options quoted and commands not executed
-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
-x
Permissible languages include: c c++ assembler none
‘none’ means revert to the default behavior of
guessing the language based on the file’s extension
Options starting with -g, -f, -m, -O, -W, or –param are automatically
passed on to the various sub-processes invoked by gcc. In order to pass
other options on to these processes the -W
For bug reporting instructions, please see:
For Debian GNU/Linux specific bug reporting instructions, please see:
4,ok,写个helloworld试试gcc
debian-dk:~# ls
debian-dk:~# vim hello.c
debian-dk:~# gcc -o hello hello.c
hello.c:1:19: error: stdio.h: 没有那个文件或目录
hello.c: In function ‘main’:
hello.c:4: warning: incompatible implicit declaration of built-in function ‘printf’
出问题了,找不到stdio.h,那是因为没装库,装上libc6-dev就行了,往下走
5,安装libc库
debian-dk:~# apt-get install libc-dev
正在读取软件包列表… 完成
正在分析软件包的依赖关系树… 完成
注意,我选了 libc6-dev 而非 libc-dev
将会安装下列额外的软件包:
libc6-dev linux-kernel-headers
建议安装的软件包:
glibc-doc manpages-dev
下列【新】软件包将被安装:
libc6-dev linux-kernel-headers
共升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 0 个软件未被升级。
需要下载 0B/4591kB 的软件包。
解压缩后会消耗掉 22.2MB 的额外空间。
您希望继续执行吗?[Y/n]y
选中了曾被取消选择的软件包 linux-kernel-headers。
(正在读取数据库 … 系统当前总共安装有 53056 个文件和目录。)
正在解压缩 linux-kernel-headers (从 …/linux-kernel-headers_2.6.18-7_i386.deb) …
选中了曾被取消选择的软件包 libc6-dev。
正在解压缩 libc6-dev (从 …/libc6-dev_2.3.6.ds1-13_i386.deb) …
正在设置 linux-kernel-headers (2.6.18-7) …
正在设置 libc6-dev (2.3.6.ds1-13) …
6,ok装好了,再来看看helloworld
debian-dk:~# gcc -o hello hello.c
debian-dk:~# ls
hello hello.c
debian-dk:~# ./hello
hello debian world!
7,finished!
20071121 midp java midp invalid
http://www.yippeesoft.com
sudo apt-get install build-essential libglib2.0-dev libgtk2.0-dev libxml-dev
sudo apt-get install libvte-dev libstartup-notification0-dev alsa
sudo apt-get install libhal-storage-dev libdbus-glib-1-dev python
sudo apt-get install libxrender-dev libxdamage-dev libjpeg62-dev
sudo apt-get install libxml++2.6-dev libice-dev libsm-dev libxpm-dev
sudo apt-get build-dep xfce-mcs-manager
sudo apt-get build-dep exo
JAVA 虚拟机的移植需要KVM和MIDP两部分, KVM是实现Class文件的自节码的解析,先到SUN公司的网站下载CLDC和MIDP吧,MIDP把两个版本都下到工作目录,我的工作目录是 /home/ljq,CLDC用1.0的, CLDC1.1支持浮点,但是1.1的编译通不过,MIDP用2.0的,CLDC其实就是KVM
解压这两个压文件.
把其中的CLDC目录用mv命令改成为kvm, 否则编译midp的时候找不到该目录,这也是我的血泪摸索的啊
mv cldc kvm
可以先看看解压后的doc目录下的移植帮助
1. 编译KVM
cd kvm/build
make
2. 编译MIDP
cd $HOME/midp2.0fcs/build/linux/kvm
make
3. 可以看到bin目录下生成了preverify等工具,然后运行下看看吧
./bin/midp
看到一个JAVA手机的模拟器了吧
上一章我实现了CLDC和MIDP在X11上的运行, 今天在LINUX下装了个Appatch 服务器, MIDP的模拟器件可以下载JAVA游戏行了.至于LINUX Appatch服务器怎么安装配置,我也是在网上查的, 当然弄个windows版本的也可以.只要http服务能在MIDP模拟器访问到就OK了.
QT是用g++编译的, 而CLDC和MIDP是c写的, 所以CLDC和MIDP是不能拿gcc做成库的,因为它要调用QT中C++的函数,至于C中怎么调用C++中的代码,我在开帖说明.但是我觉得先有C后有C++,所以不修改C++代码是无法让C调用C++的函数的. 所以干脆让C文件就g++编译不就OK了.
我修改了MIDP和CLDC中相关的Makefile,把里面的GCC改为g+, 把其中JRE的路径也改为JRE安装的路经. 还有原来MIDP中的Makefile还定了X11库的位置, 因为它调用了X11的库函数, 现在把Makefile中的这些连接的库都去掉,而是加上QT的库,我的QT库的位置在 -L($QTE_DIR) -lqte -L($QTOPIA_DIR) -lqtopia
当然你根据自己的情况把 $QTE_DIR用实际的qte库的路径代替.
修改后编译MIDP和CLDC, CLDC可以编译通过,因为它调用的都是LINUX的系统函数.而MIDP这下编译通不过了,提示很多的X11的函数找不到.下部的工作就是把这些X11的函数用QT中的函数替换, 还有就是要把模拟器的壳子去掉
顺便问下: 在VC++6.0中,若源文件的扩展名是.c, 怎么设置让它用c++编译器来设置.我暂时没有想到办法, 以前遇到VC工程中既有C又有cpp扩展名的源文件,要么把c把为cpp, 要么把c的文件编译成一个库
静态函数的预先声明
GCC 4.0不支持将一个静态函数的预先(forward)定义直接放到另一个函数的函数体内部。为了修正这个问题,可以将声明移到函数的外部(移到文件名字空间的级别上)。
int foo(int i) &leftsign;
static int bar(int j); // ERROR: invalid storage class for function \’bar
bar(i+5);
&rightsign;
static int bar(int j); // OK
int foo(int i) &leftsign;
bar(i+5);
&rightsign;
标签:gcc, invalid, java, midp20070811 gcc 编译
http://www.yippeesoft.com
Static和Extern
现在,如果您在工程中用extern和static关键字声明同一个变量,GCC 4.0会向您发出警告。过去,编译器则是以最后出现的声明为准。
当您在一个文件中创建一个局部的静态(static)变量,然后在另一个文件中将同名变量声明为extern,就会出现这种问题。请不要使用这样的做法,相反,应该修改静态变量的名称,使之不同于全局变量的名称。
// foo.h:
extern int _defaultWidth; // used by lots of compilation units
// foo.c:
static int _defaultWidth; // local copy — ERROR: static declaration of \’_defaultWidth\’ follows non-static declaration
const gchar* gtk_file_selection_get_filename(GtkFileSelection *filesel);
用gchar*没有加const就报了
assignment discards qualifiers from pointer target type
变量上加了const就正常了
Q6.16: 我碰到一个涉及 `Dl_info\’ 的编译错误。
A: 如果你的错误是这样的
unix_dl.c: In function `rep_open_dl_library\’:
unix_dl.c:328: warning: assignment discards qualifiers from pointer target type
unix_dl.c: In function `rep_find_c_symbol\’:
unix_dl.c:466: error: `Dl_info\’ undeclared (first use in this function)
unix_dl.c:466: error: (Each undeclared identifier is reported only once
unix_dl.c:466: error: for each function it appears in.)
unix_dl.c:466: error: parse error before "info"
unix_dl.c:467: error: `info\’ undeclared (first use in this function)
make[1]: *** [unix_dl.lo] Error 1
最可能是你有这样的一个头文件:/usr/local/include/dlfcn.h,它和 Panther 不兼容。
这一般是由 Open Office 所安装的,你应该通过符号链接把这个头文件和对应的 /usr/local/lib/libdl.dylib 库指向 Panther 的内置文件
sudo ln -s /usr/include/dlfcn.h /usr/local/include/dlfcn.h
sudo ln -s /usr/lib/libdl.dylib /usr/local/lib/libdl.dylib
2.问题:某一个类中如果加入Q_OBJECT后,则link时提示:undefined reference to vtable for "xxx::xxx".删掉它则没有任何问题.
解决:尝试(1):把所有的obj文件和uic文件删除,重新编译.仍然失败.
去trolltech的mail lists找到原因: 因为qmake生成Makefile的时候,这个类的头文件中并没有Q_OBJECT,所以在相应的Makefile里面并没有用moc xxx.h命令,最终导致链接失败.重新运行qmake,问题解决.
在查找解决方法的时候,附带发现一点:
qmake不会处理.cpp文件里的Q_OBJECT,所以,如果在.cpp文件中有它的话,也会产生undefined reference to vtable for "xxx::xxx". 这时,需要先用moc xxxx.cpp生成相应的moc文件,再包含到.cpp里面去,才能解决这个问题.
编译Apache的时候出现“undefined reference to “__inet_ntoa” or other __inet_* symbols”怎么办
创建:2005-10-27 16:18:51
作者:Unlinux
来自: http://www.Unlinux.com
如果你用源码包安装过BIND8,那么这个问题应该是由于头文件和库文件的冲突。源码安装的BIND8缺省把它的头文件和库文件安装在 /usr/local/include和/usr/local/lib下面,但是你系统带的BIND8的文件却是安装在/usr/include和 /usr/lib下面,如果你的系统先用了/usr/local/include而不是/usr/include里面的头文件,同时你的系统的BIND8 库文件版本比较低,那么就会发生冲突。
解决:编译的时候加入以下参数:
EXTRA_LDFLAGS=-lbind
注意:如果是BIND8.1.1的话,缺省的头文件和库文件都是放在/usr/local/bind下面,所以不会出现这个问题,不过为了更好地使用,最好编译的时候加入以下参数:
EXTRA_CFLAGS=-I/usr/local/bind/include
EXTRA_LDFLAGS=-L/usr/local/bind/lib
EXTRA_LIBS=-lbind
run_test.c:(.text+0×61): undefined reference to `CU_automated_run_tests\’
run_test.c:(.text+0×66): undefined reference to `CU_cleanup_registry\’
collect2: ld returned 1 exit status
make: *** [all] Error 1
但是,如果将Makefile中的
gcc -o test $(INC) $(LIB)-lcunit -lcurses -static $^
换成
gcc $^ -o test $(INC) $(LIB)-lcunit -lcurses -static
则正常。
我的系统
mafish@Mafish:/tmp/test/src> uname -a
Linux Mafish 2.6.13-15-default #1 Tue Sep 13 14:56:15 UTC 2005 i686 i686 i386 GNU/Linux
mafish@Mafish:/tmp/test/src> gcc –version
gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)
2.1.5 我生成了2.95.2版本的编译器,一切正常,但当我开始链接我的映象时,出现了错误,下面是我链接ctdt表时的错误:
ctdt.o(.data 0×3c):fake: undefined reference to `global constructors keyed to
_constructor_name_
… 许多类似的错误,有谁见过这种错误吗?
A: 该问题是由gcc(ver2.7.2-2.95.2)试图改变它得到静态构造函数的方法引起的。它不再对每个构造静态对象的模块消除函数,该方法是vxworks在编译链接过程中采用的方法。
你可以按如下修改gcc 2.95.2源代码后,恢复原先的操作。
in [source code dir]/gcc/config/arm/vxarm.h, at the very end, add:-
/* More DK patches: we undef these two in order to force the */
/* compiler to output our static constructors and destructors */
/* in the fashion to which it is accustomed…. */
#undef ASM_OUTPUT_CONSTRUCTOR
#undef ASM_OUTPUT_DESTRUCTOR
/* This one is so that GLOBAL_THING gets a $ in it\’s name */
#undef NO_DOLLAR_IN_LABEL
现在更换到你的编译目录,敲入make clean命令,然后重新编译和安装编译器。我采用这种方法是可以的,PPC版本的。它使得编译器使用老的方法来making munchable constructors。希望对你也有帮助。
(From: Dave Korn)
用gcc编译C++程序
今天写了一个C++小程序用来测试线程锁和条件唤醒。因为include <pthread.h>,所以在编译的时候要加上pthread这个选项,在编译c++程序的时候还要加上stdc++这个选项,否则会出现"undefined reference to \’__gxx_personality_v0\’ " 错误 。好了,下面就是整个编译命令:gcc -lstdc++ -lpthread -o test test.cpp
呵呵,其实用g++编译c++程序的话就不用加那个stdc++选项了。
20070703 arm-linux-gcc arm-elf-gcc 区别
http://www.yippeesoft.com
现在我的问题是
ARM-LINUX-GCC在有些版本的UCLINUX不能运行
有些可以
http://www.ednchina.com/blog/tod/29985/message.aspx
作者: forest 出自: http://www.linuxdiyf.com
在基于ARM的嵌入式系统开发中,常常用到交叉编译的GCC工具链有两种:
arm-linux-*和 arm-elf-*,两者区别主要在于使用不同的C库文件。arm-linux-*使用
GNU的Glibc,而arm-elf-*一般使用 uClibc/uC-libc或者使用REDHAT专门为嵌入式系统
的开发的C库newlib.Glibc。uClibc/uC-libc以及 newlib都是C语言库文件,只是所应
用的领域不同而已,Glibc是针对PC开发的,uClibc/uC-libc是与Glibc API兼容的小型
化C语言库,实现了Glibc部分功能。
关于uClibc/uC-libc的说明,详见如下:
There are two libc libraries commonly used with uClinux. uC-libc and
uClibc. They are quite different despite their similar names. Here is a
quick overview of how they are different.
uC-libc is the original library for uClinux. It was based on sources
from the Linux-8086 C library which was part of the ELKs project with m68000
support added by Jeff Dionne and Kenneth Albanowski. It is a fairly complete
libc implementation, however, some of the API\’s are a little non-standard
and quite a few common libc routines are not present. Currently it has
stable support for m68000, ColdFire and ARM (Non-MMU) architectures. It was
primary design goal is to be small and light weight. It does try to conform
to any standards, although its API tries to be compatible with most libcs,
it is not always exactly the same.
The uClinux distribution provides an environment that can compile using
either uC-libc or uClibc depending on your needs. For m68000 and Coldfire
platforms it is generally better to chose uC-libc as it supports shared
libraries and is the most commonly used libc for these CPUs. uClibc also
works quite well with almost all platforms supported by the distribution.
Which libc you choose to use will be decided by your requirements
uClinux有两个经常使用的libc库:uC-libc和uClibc。虽然两者名字很相似,其实有差
别,下面就简单的介绍一下二者的不同之处。uC -libc是最早为uClinux开发的库,是
Jeff Dionne和Kenneth Albanowski为在EKLs项目中支持m68000在Linux-8086 C库源码
上移植的。uC-libc是一个完全的libc实现,但其中有一些api是非标准的,有些libc的
标准也没有实现。uC-libc稳定地支持 m68000,ColdFire和没有MMU的ARM。其主要设计
目标是“小”、"轻",并尽量与标准一致,虽然它的API和很多libc兼容,但是似乎并
不像它期望的那样和所有标准一致。
uClibc就是为了解决这个问题从uC-libc中发展出来的。它的所有API都是标准的(正确
的返回类型,参数等等),它弥补了uC-libc中没有实现的libc标准,现在已经被移植到
多种架构中。一般来讲,它尽量兼容glibc以便使应用程序用uClibc改写变的容易。
uClibc能够在标准的 VM linux和uClinux上面使用。为了应用程序的简洁,它甚至可以
在许多支持MMU的平台上被编译成共享库。Erik Anderson在uClibc背后做了很多的工
作。uClibc支持许多系列的处理器:m68000,Coldfire,ARM,MIPS,v850, x86,
i960,Sparc,SuperH,Alpha,PowerPC和Hitachi 8。不断增加的平台支持显示uClibc
能够很容易的适应新的架构。uClinux发行版提供了环境能够让你选择使用uC-libc或是
uClibc编译。对于m68000和Coldfire平台来说,选择uC-libc还是稍微好一点,因为它
支持共享库,而共享库是这些cpu经常使用的 libc.uClibc也几乎和所有的平台都能很
好的工作。选择哪种libc取决于你的需求。
newlib 是一个用于嵌入式系统的开放源代码的C语言程序库,由libc和libm两个库组
成,特点是轻量级,速度快,可移植到很多CPU结构上。newlib实现了许多复杂的功
能,包括字符串支持,浮点运算,内存分配(如malloc)和I/O流函数(printf,fprinf()
等等)。其中libc提供了c 语言库的实现,而libm提供了浮点运算支持。
在为ARM交叉编译gcc编译器时,对gcc指定不同的配置选项时,使用的C语言库就不同,
gcc编译器默认使用Glibc,也可以使用 uClibc/uC-libc(基本兼容Glibc API),当使用
–with-newlib时,gcc编译器不使用Glibc。当没有交叉编译Glibc时,可以使用
–with-newlib禁止连接Glibc而编译bootstrap gcc编译器。从gcc源目录下的
config/arm中的t-linux和t-arm-elf中可以看出,不同的–target也影响gcc连接C语言
库,t-linux(–target=arm-linux)默认使用Glibc,-arm-elf(–target=arm-elf)使用
- Dinhibit_libc禁止连接Glibc,这时我们就可以使用newlib等其他C语言库编译GCC工
具链。
虽然GCC工具链配置了不同的的C语言库,但由于这些C语言库都可以用来支持GCC,它们
对核心数据的处理上不存在较大出入。因而arm-linux-* 和 arm-elf-*区别主要表现在
C语言库的实现上,例如不同系统调用,不同的函数集实现,不同的ABI\\启动代码以及
不同系统特性等微小的差别。
arm-linux-*和 arm-elf-*的使用没有一个绝对的标准,排除不同库实现的差异,gcc可
以编译任何系统。arm-linux-*和 arm-elf-*都可以用来编译裸机程序和操作系统,只
是在遵循下面的描述时系统程序显得更加协调:
arm-linux-*针对运行linux的ARM机器,其依赖于指定的C语言库Glibc,因为同样使用
Glibc的linux而使得arm-linux-*在运行linux的ARM机器上编译显得更加和谐。
arm-elf-*则是一个独立的编译体系,不依赖于指定的C语言库Glibc,可以使用newlib
等其他C语言库,不要求操作系统支持,当其使用为嵌入式系统而设计的一些轻巧的C语
言库时编译裸机程序(没有linux等大型操作系统的程序),如监控程序,bootloader等
能使得系统程序更加小巧快捷。
0223 uniwin eclipse cdt gcc cygwin 3 ftp
0223 uniwin eclipse cdt gcc cygwin 1
http://www.yippeesoft.com/blog/p/0223uniwineclipsecdtgcccygwin1.php
0223 uniwin eclipse cdt gcc cygwin 2
http://www.yippeesoft.com/blog/p/0223uniwineclipsecdtgcccygwin2.php
终于发现问题所在:
我在LINUX下面直接运行也是如此:
[sf@mobile Debug]$ g++ -O0 -g3 -Wall -c -fmessage-length=0 -otttt.o ../tttt.cpp
[sf@mobile Debug]$ g++ -otttt.exe ./tttt.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0×18): In function `_start\’:
../sysdeps/i386/elf/start.S:77: undefined reference to `main\’
collect2: ld returned 1 exit status
仔细一看:
总用量 4
drwxr-xr-x 2 sf root 4096 2月 23 12:40 Debug
-rw-r–r– 1 sf root 0 2月 23 09:21 t.c
-rw-r–r– 1 sf root 0 2月 23 12:22 tttt.cpp
文件居然都是空的?!
所以虽然编译出来
总用量 4
-rw-r–r– 1 sf root 1992 2月 23 12:40 tttt.o
但是没有办法连接了
但是看看UNIWIN的LOG,应该没有什么问题啊
local: O:/java/eclipse/works/tttt/tttt.cpp
==> remote: /home/sf/tttt/tttt.cpp
local: O:/java/eclipse/works/tttt/tttt.cpp
==> remote: /home/sf/tttt/tttt.cpp
没有报告什么
=> no operation taken.
之类的,真是非常奇怪~~~~~
然后在LINUX下面VI复制代码。直接编译出来A.OUT,运行OK,再用ECLIPSE编译
Building file: ../tttt.cpp
Invoking: GCC C++ Compiler
O:/java/eclipse/Uniwin/bin/g++ -O0 -g3 -Wall -c -fmessage-length=0 -otttt.o ../tttt.cpp
Finished building: ../tttt.cpp
Building target: tttt.exe
Invoking: GCC C++ Linker
O:/java/eclipse/Uniwin/bin/g++ -otttt.exe ./tttt.o
Finished building target: tttt.exe
Build complete for project tttt
非常OK
0223 uniwin eclipse cdt gcc cygwin 4 ftp
代码:以前玩嵌入式LINUX交叉编译的
#include <stdio.h>
int main(void)
&leftsign;
int i;
for(i = 0; i < 6; i++)&leftsign;
printf("i = %d ",i);
printf("Hello, embedded linux!\\n");
&rightsign;
return 0;
&rightsign;
输出很正常
./tttt
i = 0 Hello, embedded linux!
i = 1 Hello, embedded linux!
i = 2 Hello, embedded linux!
i = 3 Hello, embedded linux!
i = 4 Hello, embedded linux!
i = 5 Hello, embedded linux!
可是我修改了一下循环次数,编译又出现
**** Incremental build of configuration Debug for project tttt ****
make -k all
Building file: ../tttt.cpp
Invoking: GCC C++ Compiler
O:/java/eclipse/Uniwin/bin/g++ -O0 -g3 -Wall -c -fmessage-length=0 -otttt.o ../tttt.cpp
Finished building: ../tttt.cpp
Building target: tttt.exe
Invoking: GCC C++ Linker
O:/java/eclipse/Uniwin/bin/g++ -otttt.exe ./tttt.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0×18): In function `_start\’:
../sysdeps/i386/elf/start.S:77: undefined reference to `main\’
collect2: ld returned 1 exit status
Finished building target: tttt.exe
Build complete for project tttt
再一看LINUX下面文件
总用量 4
drwxr-xr-x 2 sf root 4096 2月 23 12:50 Debug
-rw-r–r– 1 sf root 0 2月 23 09:21 t.c
-rw-r–r– 1 sf root 0 2月 23 12:49 tttt.cpp
又为0字节了,我怀疑是FTP失败,创建了新文件,但是没有能够传输字节上去
标签:cdt, cli, cygwin, eclipse, ftp, gcc, uniwin, win0223 uniwin eclipse cdt gcc cygwin 2
0223 uniwin eclipse cdt gcc cygwin 1
http://www.yippeesoft.com/blog/p/0223uniwineclipsecdtgcccygwin1.php
0223 uniwin eclipse cdt gcc cygwin 3 ftp (2006-6-14)
0223 uniwin eclipse cdt gcc cygwin 4 ftp (2006-6-13)
原来老是习惯性按下 确定,把UNIWIN关了,打开之后再 BUILD 结果
Building file: ../tttt.cpp
Invoking: GCC C++ Compiler
O:/java/eclipse/Uniwin/bin/gcc -O0 -g3 -Wall -c -fmessage-length=0 -otttt.o ../tttt.cpp
gcc: ../tttt.cpp: 没有那个文件或目录
gcc: no input files
Finished building: ../tttt.cpp
Building target: tttt.exe
Invoking: GCC C++ Linker
g++ -otttt.exe ./tttt.o
/bin/../lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../libcygwin.a(libcmain.o)(.text+0xb3): undefined reference to `_WinMain@16\’
collect2: ld returned 1 exit status
make: *** [tttt.exe] Error 1
make: Target `all\’ not remade because of errors.
Build complete for project tttt
看来是文件没有上传上去,按照作者说的,随便加了一个空格,保存,现在LINUX下面有了。
Building file: ../tttt.cpp
Invoking: GCC C++ Compiler
O:/java/eclipse/Uniwin/bin/gcc -O0 -g3 -Wall -c -fmessage-length=0 -otttt.o ../tttt.cpp
Finished building: ../tttt.cpp
Building target: tttt.exe
Invoking: GCC C++ Linker
g++ -otttt.exe ./tttt.o
/bin/../lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../libcygwin.a(libcmain.o)(.text+0xb3): undefined reference to `_WinMain@16\’
collect2: ld returned 1 exit status
make: *** [tttt.exe] Error 1
make: Target `all\’ not remade because of errors.
Build complete for project tttt
继续修改BUILDER LINK 选项
**** Full rebuild of configuration Debug for project tttt ****
make -k clean all
rm -rf ./tttt.o ./tttt.d tttt.exe
Building file: ../tttt.cpp
Invoking: GCC C++ Compiler
O:/java/eclipse/Uniwin/bin/gcc -O0 -g3 -Wall -c -fmessage-length=0 -otttt.o ../tttt.cpp
Finished building: ../tttt.cpp
Building target: tttt.exe
Invoking: GCC C++ Linker
O:/java/eclipse/Uniwin/bin/gcc -otttt.exe ./tttt.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0×18): In function `_start\’:
../sysdeps/i386/elf/start.S:77: undefined reference to `main\’
collect2: ld returned 1 exit status
Finished building target: tttt.exe
Build complete for project tttt
0223 uniwin eclipse cdt gcc cygwin 1
作者很强:升级很快
我还是装了一个vmware + linux测试了一下telnet/ftp组合,把最后的在我这边跑的很happy的放到一个叫02_22_2006的patch里面了。
于是今天继续试用:
作者说:
只要%path of uniwin%/uniwin/bin在PATH环境变量最前面,eclipse缺省调用gcc, 就会调用uniwin/bin/目录下的gcc。这块不用设置。
结果:
这是XP设置用户变量
O:\\微软\\VS6\\Common\\Tools\\WinNT;O:\\微软\\VS6\\Common\\MSDev98\\Bin;O:\\微软\\VS6\\Common\\Tools;O:\\微软\\VS6\\VC98\\bin;N:\\share\\UltraEdit-32;O:\\ms\\xpsdk\\Bin\\.;O:\\ms\\xpsdk\\Bin\\WinNT\\;
全局变量
O:\\java\\eclipse\\Uniwin\\bin;%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\system32\\WBEM;F:\\Program Files\\Common Files\\GTK\\2.0\\bin;F:\\WINXP\\Microsoft.Net\\Framework\\v1.1.4322;O:\\ms\\xpsdk\\Bin\\.;O:\\ms\\xpsdk\\Bin\\WinNT\\.;F:\\Program Files\\Microsoft SQL Server\\90\\Tools\\binn\\;F:\\Program Files\\Subversion\\bin
这是DOS下变量
Path=O:\\java\\eclipse\\Uniwin\\bin;F:\\WINXP\\system32;F:\\WINXP;F:\\WINXP\\system32\\WBEM;F:\\Program Files\\Common Files\\GTK\\2.0\\bin;F:\\WINXP\\Microsoft.Net\\Framework\\v1.1.4322;O:\\ms\\xpsdk\\Bin\\.;O:\\ms\\xpsdk\\Bin\\WinNT\\.;F:\\Program Files\\Microsoft SQLServer\\90\\Tools\\binn\\;F:\\Program Files\\Subversion\\bin;O:\\微软\\VS6\\Common\\Tools\\WinNT;O:\\微软\\VS6\\Common\\MSDev98\\Bin;O:\\微软\\VS6\\Common\\Tools;O:\\微软\\VS6\\VC98\\bin;N:\\share\\UltraEdit-32;O:\\ms\\xpsdk\\Bin\\.;O:\\ms\\xpsdk\\Bin\\WinNT\\;O:\\java\\eclipse\\Uniwin\\bin;F:\\WINXP\\system32;F:\\WINXP;F:\\WINXP\\system32\\WBEM;F:\\Program Files\\Common Files\\GTK\\2.0\\bin;F:\\WINXP\\Microsoft.Net\\Framework\\v1.1.4322;O:\\ms\\xpsdk\\Bin\\.;O:\\ms\\xpsdk\\Bin\\WinNT\\.;F:\\Program Files\\Microsoft SQL Server\\90\\Tools\\binn\\;F:\\Program Files\\Subversion\\bin;N:\\TOOLS;N:\\TOOLS\\NC;"D:\\ProgramFiles\\MicrosoftSQLServer\\80\\Tools\\Binn\\"
可是到了ECLIPSE第一个变成 M:\\CYGWIN\\BIN
然后就报告
Severity Description Resource In Folder Location Creation Time Id
1 Error launching \’cygpath\’ command tttt 2006年2月23日 9:29:31 3
Severity Description Resource In Folder Location Creation Time Id
1 C/C++ Indexer Problem: Preprocessor Inclusion not found: stdio.h in file: O:\\java\\eclipse\\works\\tttt\\t.c on line: 1. t.c tttt line 1 2006年2月23日 9:35:20 4
作者提示:
我也碰到这个问题过,我在step by step里写了eclipse和cygwin紧紧绑定,使用uniwin的时候‘如果装了cygwin, 请不要装gcc & g++那部分’。
不知道把cygwin的原来的gcc, g++换个名字行不行,我装了cygwin, 但是不装gcc, g++是可以的。
或者在eclipse配置project的编译器把gcc指定到O:\\java\\eclipse\\Uniwin\\bin\\gcc我想应该行的
我修改了一下:
**** Full rebuild of configuration Debug for project tttt ****
make -k clean all
rm -rf ./tttt.o ./tttt.d tttt.exe
Building file: ../tttt.cpp
Invoking: GCC C++ Compiler
O:\\java\\eclipse\\Uniwin\\bin\\gcc -O0 -g3 -Wall -c -fmessage-length=0 -otttt.o ../tttt.cpp
O:javaeclipseUniwinbingcc: not found
make: *** [tttt.o] Error 127
make: Target `all\’ not remade because of errors.
Build complete for project tttt
修改 O:\\java\\eclipse\\Uniwin\\bin\\ 为 O:/java/eclipse/Uniwin/bin/ 结果
make -k clean all
rm -rf ./tttt.o ./tttt.d tttt.exe
Building file: ../tttt.cpp
Invoking: GCC C++ Compiler
O:/java/eclipse/Uniwin/bin/gcc -O0 -g3 -Wall -c -fmessage-length=0 -otttt.o ../tttt.cpp
Could not open file mapping object (2).
Running gserver first!
make: *** [tttt.o] Error 255
make: Target `all\’ not remade because of errors.
Build complete for project tttt