分类目录
文章索引模板
20071024 kvm uclinux error - 七月 25, 2008 by yippee

20071024 kvm uclinux
http://www.yippeesoft.com

错误一大堆~~~~~~

[root@mobile build]# make
mkdir -p obj
mkdir -p fp_obj
… obj/cache.o
arm-elf-gcc: unrecognized option `-Xa\’
arm-elf-gcc: language O2 not recognized
arm-elf-gcc: ../../../kvm/VmCommon/src/cache.c: linker input file unused since linking not done
… obj/class.o

用ARM-UCLINUX-GCC

../../../kvm/VmUnix/src/runtime_md.c: In function `InitializeFloatingPoint\’:
../../../kvm/VmUnix/src/runtime_md.c:171: error: `_FPU_EXTENDED\’ undeclared (first use in this function)
../../../kvm/VmUnix/src/runtime_md.c:171: error: (Each undeclared identifier is reported only once
../../../kvm/VmUnix/src/runtime_md.c:171: error: for each function it appears in.)
../../../kvm/VmUnix/src/runtime_md.c:171: error: `_FPU_DOUBLE\’ undeclared (first use in this function)

用ARM-ELF-GCC
/tmp/ccmzsd5d.s: Assembler messages:
/tmp/ccmzsd5d.s:301: Error: bad instruction `fldcw [fp,#-14]\’

#error Attempted to include iconv.h when uClibc built without locale support.
In file included from ../../src/convert_md.c:22:
/usr/local/arm-uclinux-tools/lib/gcc/arm-uclinux/3.4.0/../../../../arm-uclinux/include/iconv.h:27:2: #error Attempted to include iconv.h when uClibc built without locale support.
../../src/convert_md.c: In function `native2utf8\’:
../../src/convert_md.c:86: warning: passing arg 2 of `iconv\’ from incompatible pointer type
../../src/convert_md.c: In function `utf2native\’:
../../src/convert_md.c:117: warning: passing arg 2 of `iconv\’ from incompatible pointer type

Version 1.0 of the CLDC Specification did not require floating-point arithmetic in compliant implementations. However, the CLDC Specification Version 1.1 does require floating-point, and this chapter describes the implications for porting the floating-point implementation for KVM in CLDC 1.1.

[root@mobile linux]# make
/usr/local/arm-uclinux-tools/bin/arm-uclinux-gcc /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crtl.o /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crtn.o  -o preverify check_class.o main.o utf.o check_code.o convert_md.o util.o jar.o jar_support.o classloader.o file.o classresolver.o stubs.o inlinejsr.o sys_support.o
arm-uclinux-gcc: /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crtl.o: No such file or directory

loader.o file.o classresolver.o stubs.o inlinejsr.o sys_support.o
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o: In function `_start\’:
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o(.text+0×0): multiple definition of `_start\’
/usr/local/arm-elf/lib/crt0.o(.text+0×0): first defined here
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o: In function `_start\’:
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o(.text+0×0): multiple definition of `_start\’
/usr/local/arm-elf/lib/crt0.o(.text+0×0): first defined here

main.o(.text+0×32c): the \’setlocale\’ function supports only C&line;POSIX locales
appptt.elf2flt: In function `open_iconv\’:
appptt.elf2flt(.text+0xa2e0): undefined reference to `iconv_open\’
appptt.elf2flt: In function `native2utf8\’:
appptt.elf2flt(.text+0xa478): undefined reference to `iconv\’
appptt.elf2flt(.text+0xa4a4): undefined reference to `iconv_close\’
appptt.elf2flt: In function `utf2native\’:
appptt.elf2flt(.text+0xa55c): undefined reference to `iconv\’
appptt.elf2flt(.text+0xa588): undefined reference to `iconv_close\’

~~~~~~~~~~
·htonl():把32位值从主机字节序转换成网络字节序
·htons():把16位值从主机字节序转换成网络字节序
·ntohl():把32位值从网络字节序转换成主机字节序
·ntohs():把16位值从网络字节序转换成主机字节序

修改了MAKEFILE文件后没有了

[alert7@redhat]# nasm -f elf tiny.asm
[alert7@redhat]# gcc -Wall -s tiny.o
tiny.o: In function `_start\’:
tiny.o(.text+0×0): multiple definition of `_start\’
/usr/lib/crt1.o(.text+0×0): first defined here
/usr/lib/crt1.o: In function `_start\’:
/usr/lib/crt1.o(.text+0×18): undefined reference to `main\’
collect2: ld returned 1 exit status

如何做才可以编译过去呢?
GCC有一个编译选项–nostartfiles

-nostartfiles
当linking时,不使用标准的启动文件。但是通常是使用的。

修改文件

这里,我们要修改的只有两处,那就是j2me_cldc/kvm/VmUnix/build/Makefile文件。因为我们的KVM是要运行在arm-linux(这里cpu为arm体系结构,操作系统为linux的开发板简称为arm-linux)系统上。所以,KVM必须用arm-linux-gcc编译器编译。我们打开Makefile文件,把

ifeq ($(GCC), true)

   CC = gcc

   …………

else

处的gcc改成arm-linux-gcc:

ifeq ($(GCC), true)

   CC = arm-linux-gcc

   …………

Else

 

第二处就是j2me_cldc/kvm/VmUnix/src/runtime_md.c文件,把这个文件中void InitializeFloatingPoint()函数中的两句注释掉,如:

#if defined(LINUX) && PROCESSOR_ARCHITECTURE_X86
/* Set the precision FPU to double precision */
// fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) &line; _FPU_DOUBLE;
// _FPU_SETCW(cw);
#endif

 

这样,就不会出现错误了,但也不支持浮点数了。这里我还不知道如何才能让它支持浮点数,并不出现错误。

这个是移植cldc1.1的:步骤基本相同,我们主要说以下不同的地方:修改完makefile后,make,会出现错误提示:
make: *** [obj/runtime_md.o] Error 1我们向上察看:kvm/VmUnix/src/runtime_md.c: In function `InitializeFloatingPoint’:是在函数InitializeFloatingPoint中出现错误:我们可以采取简单的方法将其注释掉,
void InitializeFloatingPoint() &leftsign;
#if defined(LINUX) && PROCESSOR_ARCHITECTURE_X86
/* Set the precision FPU to double precision */
// fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) &line; _FPU_DOUBLE;
// _FPU_SETCW(cw);
#endif
&rightsign;当然也也可以修改一下支持flaot,ok保存以下,接着make,就ok了!goodluck!
前两年刚刚参与Linux手机平台的开发时,尝试做了一个KJava的虚拟机,这是其中一个较早的版本,当时只实现了一些核心的功能,使用zlib和sun参考实现中的java api才能工作,可以运行基本的hello world等程序,只限于命令行,不支持UI.
 
http://blog.chinaunix.net/upfile/070823021750.zip

标签:, , , , , ,
20070820 uclinux sqlite error - 五月 24, 2008 by yippee

20070820 uclinux sqlite error
http://www.yippeesoft.com

http://blog.iyi.cn/hily/archives/2006/10/sqlite.html
http://www.potu.com/reader/itempl4672609.html
http://www.sqlite.com.cn/POParticle/6/84.Html

求救:arm-uclibc-gcc编译SQLite的问题

想把SQLite移植到ARM-uClinux上, 按照版上贴的移植方法进行

版本为: sqlite-3.3.17
由于之前多是基于arm-linux-gcc编译的, 将Makefile中有关arm-linux-的地方全换成了arm-uclibc-
maik.mk, os.c, shell等文件也进行了相应修改

但最终没有编译成功! 提示错误:
libsqlite3.a(os_unix.o):in fuction \’sqlite3UnixDlopen\’:
os_unix.o(.text+0xfb4):undefined reference to \’dlopen\’
libsqlite3.a(os_unix.o): In function \’sqlite3UnixDlsym\’:
os_unix.o(. text+0xfc8): undefined reference to \’dlsym\’
libsqlite3.a(os_unix.o): In function \’sqlite3UnixDlclos\’:
os_unix.o(. text+)xfdc): undefined reference to \’dclose\’
collect3: ld returned 1 exit status
make: ***[sqlite3] Error 1

I followed to below order to crosscompile the source but the end I get some undefined reference errors.

Do you have any idea how to solve this problem.

Note: There is no problem when I try to crosscompile ver. 2.8.17. Every thing works great.

**********************
rm tclsqlite.c

PATH=/usr/local/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/bin/:$PATH

for i in *.c; do arm-gcc -O -c $i; done

rm shell.o

ar cr libsqlite.a *.o

ranlib libsqlite.a

arm-gcc -o sqlite shell.c libsqlite.a
libsqlite.a(os_unix.o)(.text+0xf6c): In function `sqlite3UnixDlopen\’:
: undefined reference to `dlopen\’
libsqlite.a(os_unix.o)(.text+0xf78): In function `sqlite3UnixDlsym\’:
: undefined reference to `dlsym\’
libsqlite.a(os_unix.o)(.text+0xf84): In function `sqlite3UnixDlclose\’:
: undefined reference to `dlclose\’
collect2: ld returned 1 exit status

> Jakub Ladman schrieb:
> >> It\’s seems a bit strange to me that Makefile.linux-gcc includes tcl in
> >> the build by default, but it does. Maybe that should change…
> >>
> >> If you add "-DNO_TCL" to the OPTS variable in Makefile.linux-gcc this
> >> error should go away. i.e. add the following line somewhere after the
> >> "OPTS = -DNDEBUG" bit:
> >>
> >> OPTS += -DNO_TCL
Yes, i am idiot!!!!!!

but after correction of this i get:

                libsqlite3.a   -lpthread
libsqlite3.a(os_unix.o): In function `sqlite3UnixDlopen\’:
os_unix.c:(.text+0×848): undefined reference to `dlopen\’
libsqlite3.a(os_unix.o): In function `sqlite3UnixDlsym\’:
os_unix.c:(.text+0×85c): undefined reference to `dlsym\’
libsqlite3.a(os_unix.o): In function `sqlite3UnixDlclose\’:
os_unix.c:(.text+0×870): undefined reference to `dlclose\’
collect2: ld returned 1 exit status
make: *** [sqlite3] Error 1
[EMAIL PROTECTED] ~/src/sqlite-3.3.13 $

 In function `dlfcn_load\’

:dso_dlfcn.c:(.text+0×45): undefined reference to `dlopen\’
:dso_dlfcn.c:(.text+0xc4): undefined reference to `dlclose\’
:dso_dlfcn.c:(.text+0×102): undefined reference to `dlerror\’

解决方法:

在Makefile中的链接参数加上 -ldl就可以解决了

http://www.ccw.com.cn/cio/research/program/htm2004/20041215_110V2.asp

http://www.rzhome.net/blog/article.asp?id=11

http://www.sqlite.org/quickstart.html

http://blog.iyi.cn/hily/archives/2006/10/uclinuxberkeley_db_v4520.html

http://www.ccw.com.cn/cio/research/program/htm2004/20041215_110V2.asp

http://tech.sina.com.cn/other/2004-12-17/0840478378.shtml

http://www.xxlinux.com/linux/article/development/embed/20051201/411.html

http://www.potu.com/reader/itempl4672609.html

标签:, , , , , , ,
20070702 嵌入式 Python ERROR - 三月 21, 2008 by yippee

20070702 嵌入式 Python ERROR
http://www.yippeesoft.com

python for arm的编译没什么特别的
直接用默认的./configurate就可以了
产生的Makefile稍稍做点修改
把里头的gcc、ar、ranlib、c++都加上前缀
例如
gcc –>  arm-linux-gcc
ar   –>  arm-linux-ar
然后执行make就可以鸟
(中途会遇到一个C语言编译错误,是关于宏的,直接删除掉那一段就可以了,然后继续make)
等make完毕就可以得到\’python\’的可执行文件
可以直接拿去跑了

/bin> python
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)

elf2flt python
python: Input file contains no relocation info

undefined reference to `__DTOR_LIST__\’

./configure CC=arm-linux-gcc –host=arm
checking for %zd printf() format support… configure: error: cannot run test program while cross compiling

~~~~~~~~~~
echo "$as_me:$LINENO: checking for %zd printf() format support" >&5
echo $ECHO_N "checking for %zd printf() format support… $ECHO_C" >&6
if test "$cross_compiling" = yes; then
 &leftsign; &leftsign; echo "$as_me:$LINENO: error: cannot run test program while cross compiling
See \\`config.log\’ for more details." >&5
echo "$as_me: error: cannot run test program while cross compiling
See \\`config.log\’ for more details." >&2;&rightsign;
  &leftsign; (exit 1); exit 1; &rightsign;; &rightsign;
else
 cat >conftest.$ac_ext <<_ACEOF

~~~~~~~~~~~~~~
3, 顶值帖子 “学习使用SkyEye仿真”里编译hello.c时: a
rm-elf-gcc -Wl,-elf2flt -o hello hello.c
我如果加了-Wl参数,编译出来的是hello.gdb,
是一个elf文件,如果去掉-Wl参数,生成的是flt的文件。
在这里,hello.c中的printf()函数是静态链接的吗?
否则怎么能在没有动态链接库的romfs中运行。
为什么在这里-Bstatic参数没有作用?
还有在这里链接时没有指定程序的链接地址,那么arm-elf-tools
默认怎么做的?uClinux下运行时,怎么确定它在哪运行。

~~~~~~~~~~~~~
/usr/local/lib/gcc/arm-linux/3.4.4/../../../../arm-linux/bin/ld.real: error: no memory region specified for loadable section `.plt\’
collect2: ld returned 1 exit status

python: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped

/usr/local/arm-elf/bin/ld.real: cannot find -ldl
collect2: ld returned 1 exit status
make: *** [Parser/pgen] Error 1

~~~~~~~~~~~~~~~~
uClinux
uClinux与emDebian至少有两个重要的区别,第一是构建方式,前面已经提到过了,uClinux属于 from scratch 一类的。另一个不同的地方,uClinux是支持不在emDebian支持的11种CPU的,当然,这个说法不是很恰当,正确的说法是uClinux支持那些不具备MMU单元的CPU体系。uClinux的第一个目的是支持MC68328芯片,现在已经能构支持更多的CPU,如Intel i960,ARM等。不过,uClinux的主体开发团队目前已经不再支持ARM了,还好 Samsung 的 Hyok S. Choi 接过了接励棒,Linux 2.6版本的补丁可以在 uClinux/ARM2.6 找到。

uClinux之前仅是核心的一些补丁,后来发展成为一个包括核心、库、应用程序、工具和编译相关的配置文件的一个集成开发环境。与 buildroot不同的是,uClinux不编译目标系统的工具集,也就是说,相应的编译工具应该提前安装好。如,对于arm来说,需要先安装ARM交叉编译器。uClinux的编译器也需要一些补丁,其中比较重要的两个方面主要包括:

用于生成FLT文件的补丁:由于MMU的关系,uClinux不支持ELF可执行文件,这个补丁主要包括bin2flt工具包和一个ld的wrapper脚本等,用于(透明于用户)生成FLT文件;

用于支持XIP(Execute In Place)的补丁:这个补丁需要对gcc进行一些小的修改;支持XIP主要是为了解决小内存环境中运行的问题。

XIP不一定适用于每种应用环境,对于内在要求特别严格的系统来说(空间第一位,如手机要求使用片内RAM),可以通过将核心和应用程序编译为XIP支持,然后直接在Flash上运行,内存仅用于运行时数据;而对于性能要求为主的系统(如高速网络处理器),则不能因为节省一点空间而使用XIP将程序直接在Flash上运行,这样可能会降低指令的读取速度而影响系统性能(但仍然可以使用XIP,使程序的多个实例在内存中共享代码空间,以后详细说); + FLT可执行文件支持动态链接库(目前仅m68k支持,参见 uCdot: Shared libraries under uClinux mini-HOWTO)的补丁;

uClinux的编译过程大致是,首先,通过可视配置界面(menuconfig/xconfig)选取Vendor和board(实际上是选择了一些配置文件和产品相关的文件),然后根据选择构造一个适用于target的开发环境,如生成头文件和需要的库文件(uClibc、glibc或uC-libc 以及其它一些库),然后编译核心、库、应用程序,最后将所有的输出安装到romfs目录中,根据需要生成目标平台需要的映像文件(如: romfs.img、linux.bin、rootfs.gz等)。

由于一些过程细节被隐藏起来,uClinux现在的编译过程方便到只需要配置一下(make menuconfig),然后 make 就可以直接获得最终输出。不过这反倒成为一些初学者学习的一个麻烦,本文完成后,根据对本文的反馈,将进一步对uClinux进行详细介绍。

总的来说,目前的uClinux是一套主要用于无MMU核(但不限于此)的嵌入式Linux集成环境,也是一个非常好的 Linux from scratch 的示例。抛开其MMU相关的补丁,uClinux也可以作为一套用于包含MMU系统的集成开发环境,Snapgear 就是一个很好的例子。实际上,我们可以从官方的uClinux源码就可以直接编译一个支运行于X86的uClinux。

~~~~~~~~~~~~~
据说:
arm-linux-gcc为有MMU的LINUX准备的比如LPC2410上的LINUX

arm-elf-gcc为没有MMU的UCLINUX准备的比如LPC2100上的UCLINUX

我用的是Uclinux 所以不能用arm-linux-gcc吧?

~~~~~~~~~~~~~~~~~~
BINFMT_FLAT: reloc outside program 0×11800 (0 – 0×7064/0×5d80), killing hello!
BINFMT_FLAT: reloc outside program 0×11800 (0 – 0×7064/0×5d80), killing hello!
这种错误一般是内存分配的问题,很可能就是内存不够用了。

~~~~~~~~~~~~~
在FS44B0xII板子上运行自己的程序,就是执行不了,不知什么原因。我的操作如下:
1.按照你们提供的使用手册(以及相关的代码)将uclinux弄到板子上去了,uclinux可以运行。

2.在linux下写了一个最简单的"hello,world"的程序,文件名为"hello.c"
/**hello.c**/
#include<stdio.h>
int main()
&leftsign;
printf("hello,world!\\n");
return 0;
&rightsign;

3.安装好arm-elf-gcc编译工具,用如下方法编译
#arm-elf-gcc -o hello hello.c -elf2flt
生成hello的执行文件
4.用超级终端启动板子上的uclinux,执行
#mount -t ramfs ramfs /mnt
挂载ramfs于mnt目录下,这样mnt目录下就可以读写了

5.在mnt目录下通过ftp 下载 pc机上编译生成的hello文件,并用chmod改变权限,执行
#chmod 777 hello
#./hello
出现下面的错误:

BINFMT_FLAT: reloc outside program 0×11800 (0 – 0×7064/0×5d80), killing hello!
BINFMT_FLAT: reloc outside program 0×11800 (0 – 0×7064/0×5d80), killing hello!
Memory fault
不知道这是什么原因引起的,希望能够给予解答,谢谢!

同时,我又用arm-linux-gcc 来编译我这个hello.c文件
然后通过同样的方法下载到板子的/mnt目录下,然后执行,又报出下面的错误:

BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
hello2: applet not found

~~~~~~~~~~~~~~~
Yes, there are some differences between arm-elf, arm-linux, and
arm-uclinux toolchains.
As I know, arm-uclinux-binutils is the same as arm-linux-binutils.
arm-uclinux-gcc was patched from arm-linux-gcc to generate PIC
(Program Independent Code) code without GOT (Global Offset Table);
and arm-elf-gcc is designed for operating system independent
applications. For example, arm-elf-gcc will insert code for initializing
global C++ constructors at the beginning of main(), so even no-OS
platforms can work properly. BTW, they are almost the same while
compiling the Linux kernel.
~~~~~~~~~~~~~
No, it depends on the version of elf2flt.
The arm-uclinux-gcc is required while using old elf2flt tool.
Modern el2flt programs do not use PIC, so all three toolchains
can be used in developing userland applications.
~~~~~~~~~~~~~
使用arm-linux-gcc编译器能编译应用程序吗?
不能,编译应用程序请使用arm-elf-gcc编译器,并使用-Wl,-elf2flt连接参数生成flat格式文件。
~~~~~~~~~
arm-elf-ld -L/usr/local/uClibc -elf2flt -o hello
/usr/local/uClibc/lib/crt0.o crtbegin.o hello.o crtend.o –lc –lgcc
-lc
可以完全实现,snmpd就由此完成,以前我用 -Wl,-elf2flt=-z不行的,记住加上lgcc

有一种可能是系统里安装两个交叉编译的编译器如arm-elf-gcc,arm-linux-gcc之类的。两者都安装在/usr/local中,有可能其中一个在安装时覆盖了另一个编译器所需的文件,导致再编译时产生混乱。彻底删除(编译器和相应的库都删了才行)其中一个应该就OK了吧。

其实不然,最安全的做法是在Makefile中加入完整路径,如果你使用Redhat Linux,建议你在自己的$HOME/.bash_profile中加入路径,文件可以在任何位置,这样不会影响其它环境变量.实际上这两种编译器的路径是不同的,并不会产生冲突,真正的冲突在于系统寻找arm-elf-gcc或arm-linux-gcc的路径先后顺序.一般来说.在/bin:/sbin/usr/bin:/usr/sbin中的执行文件最快被引用./usr/local/bin: /usr/local/sbin等也可被检测,还可以用export PATH=/xxx/uuy/bi等,但编译时系统寻找的不是一定恰好是你想要的编译器.如使用2.95.3和3.0以上的是不同的.有些在低版中是通不过的,还有与你的计算机有关,如果用i386可能很好,但如果用P IV或指定Build HOST的ARCH,编译出来的结果会有差异的.甚至SIZE都不一样.有时我们发现,在新的PC中,编译过的代码在目标机上运行不起来.

直接用arm-elf-ld和arm-elf-gcc当然是不同的
蓝牙楼主用arm-elf-gcc驱动ld,缺省已经做了-lc -lgcc和
crt0.o连接的工作.
所以gcc hello.c这样简单命令就能成功编译a.out
至于arm-elf-gcc的情况加上-elf2flt,ok.

我用arm-elf-gcc -Wl,-elf2flt 编译文件,结果是放在uClinux上无法执行.出现了:
BINFMT_FLAT: bad magic/rev (0×0, need 0×4)
BINFMT_FLAT: bad magic/rev (0×0, need 0×4)
这是为什么?
uClinux使用这种格式的可执行文件格式真害人(b.out),arm-linux-gcc就可以.不是elf格式.而且没法strip, 直接用-elf2flt编译,生成的好像是strip了的.但大的系统就麻烦了.uClibc的运行库本身还是arm-elf格式的.

BINFMT_FLAT: reloc outside program 0×240d000c (0 – 0xfff83c94/0xc06a0), killing
snmpd!
BINFMT_FLAT: reloc outside program 0×240d000c (0 – 0xfff83c94/0xc06a0), killing
snmpd!
pid 79: failed 11

现在这种问题怎么解决,应当是由于uClinux中不带MMU管理的原因.重定位时,内存地址超界,但怎么办呢?

BINFMT_FLAT的问题是产生的文件不是
正确的FLAT格式.似乎没有正确调用elf2flt.
bad magic/rev没有产生出标准的magic number"bFLT 4"
reloc 的值也不对.

另外,flat格式没有symbol table,不需要strip

六、应用程序开发 -- ApplicationsLUPA开源社区&ADXW!w1A el
1.arm-elf-gcc main.c -elf2flt
arm-linux-gcc main.c

~~~~~~~~~~~~~~
我也正在编译blob,遇到的编译问题是一样的。这里说说的我的做法(使用环境RedHat 9):
1. 编辑文件 configure ,把所有arm-linux 改为arm-elf; 在580行处(“ac_ext=c”之前)插入 LDFLAGS=-elf2flt ,保存文件。

2.运行命令./configure –with-board=mba-44b0 –with-linux-prefix=/usr/local/src/uClinux-dist/linux-2.4.x (这是我的uclinux目录) –host=arm-elf

结果:LDFLAGS = -elf2flt -static -nostdlib

3.运行make

4.编译到arm-elf-objcopy -O binary -R .note .comment -S blob-start-elf32 blob-start出现错误(与你的一样):
arm-elf-objcopy:blob-start-elf32:File format not recognized
5.分析blob-start-elf32编译的命令
arm-elf-gcc -Os -I/usr/local/src/uClinux-dist/linux-2.4.x/include
-Wall -march=armv4 -mtune=strongarm1100
-fomit-frame-pointer -fno-builtin -mapcs-32 -nostdinc
-elf2flt -static -nostdlib -o blob-start-elf32
-Wl,-T,./start-ld-script start.o ledasm.o memsetup-s3c44b0.o -lgcc

使用了-elf2flt 选项,把blob-start-elf32编译成flat格式。

6.到目录 blob/src/blob目录下直接执行编译命令(把-elf2flt去掉)
arm-elf-gcc -Os -I/usr/local/src/uClinux-dist/linux-2.4.x/include
-Wall -march=armv4 -mtune=strongarm1100
-fomit-frame-ointer -fno-builtin -mapcs-32 -nostdinc
-static -nostdlib -o blob-start-elf32
-Wl,-T,./start-ld-script start.o ledasm.o memsetup-s3c44b0.o -lgcc

再执行一次
arm-elf-objcopy -O binary -R .note .comment -S blob-start-elf32 blob-start

结果顺利编译通过

显然 arm-elf-objcopy 中 blob-start-elf32 必须为elf格式
其后的blob-rest-elf32 ,blob-chain-elf32编译也应该是elf格式。

7.结论:所以编译源文件要使用 -elf2flt 才能编译通过,但编译连接 blob-start-elf32 又不能使用-elf2flt开关

~~~~~~~~~~
The kernel is reporting that the file you\’re running isn\’t a valid executable file format. For all Nios II Linux systems, each executable must be in a flat binary format. This usually entails running elf2flt on any applications that you build.

If you\’d like I can take a look at the Makefile you\’re using and try to figure out what\’s going on. If so, please pm me or post it here in the forum.

~~~~~~~~~~~~~~~
What causes \’BINFMT_FLAT: bad magic/rev (0xZZ, need 0xYY)\’ errors

FAQ A lot of people encounter this error the first time they try to run a program on a uClinux system. Usually this is caused by trying to run an ELF or COFF executable rather than a "flat" executable. uClinux does not support anything but the "flat" executable format. ELF/COFF programs are converted to "flat" format using elf2flt/coff2flt respectively.

To fix this problem with the ELF toolchain add -Wl,-elf2flt to the final link line of your build and it will create a flat executable. For the COFF toolchain there is some excellent feedback by jeff included in the followup comments to this story.

~~~~~~~~~~~~
我把编译后在microwindows/src/bin生成的一些可执行文件放到romfs中(如demo,demo1),
用genromfs打包后倒入到开发板上,运行该文件,出现:

BINFMT_FLAT:bad magic/rev (0×1010161,need 0×4)
BINFMT_FLAT:bad magic/rev (0×1010161,need 0×4)
./demo: Exec format error

我想可能是编译器的问题,产生的文件格式不是FLAT的,是不是不能用arm-linux-gcc而要改成
arm-elf-gcc,所以在make xconfig时把编译器改成arm-elf-gcc,但编译出错:
Compiling srvnet.c …
Linking /root/uclinux/microwindows-0.90/src/bin/nano-X …
collect2: ld terminated with signal 11 [Segmentation fault],core dumped
make[1]:*** [/root/uclinux/microwindows-0.90/src/bin/nano-X] Error 1
make: *** [subdir-nanox] Error 2

~~~~~~~
Hi ,everyone:

Who can tell me the difference between elf,coff,flt file format?

I used arm-linux-cross.tar.bz2 compiled my uClinux-2.4.x and busybox0.60.5,generate coff file,I load the generated file to my EVM board,kernel can run success,but busybox can not run,the result of running is:

/dev/console initialized successfully.
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
BINFMT_FLAT: bad magic/rev (0×1010161, need 0×4)
Kernel panic: No init found.  Try passing init= option to kernel.

I suspect that busybox is not in flat format, I can not confirm that arm-linux-cross toolchain has not elf2flt function.I use arm-linux-cross.tar.bz2 toolchain compile elf2flt-20020731.tar.gz,failed,prompt as following:

/data/lart/cross/bin/arm-linux-gcc -g -O2 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_UNISTD_H=1 -DHAVE_BFD_H=1 -DHAVE_VPRINTF=1  -DTARGET_arm -I/data/lart/cross/arm-linux/include -static -o elf2flt ./elf2flt.c /data/lart/cross/lib/libbfd.a /data/lart/cross/lib/libiberty.a
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
make: *** [elf2flt] Error 1

~~~~~~~~~~~~~
而我要用在的ARM9上(ARM7也一样,都是flat的文件格式,库文件也是),我所用的交叉编译工具是arm-linux-gcc, 版本3.3.2.我首先在db-4.5.20下新建了一个build_arm_linux目录,然后编译,命令如下:
mkdir build_arm_linux
cd build_arm_linux
../dist/configure CC=arm-linux-gcc –host=arm
make

~~~~~~~~~~~~~~~

标签:, , , ,

20070605 vs2005 cstring error C2679 - 二月 7, 2008 by yippee

20070605 vs2005 cstring error C2679
http://www.yippeesoft.com

缺少UNICODE编码经验

Concatenating Two CString Objects
To concatenate two CString objects, use the concatenation operators (+ or +=) as follows:

  Copy Code
CString s1 = "This ";        // Cascading concatenation
s1 += "is a ";
CString s2 = "test";
CString message = s1 + "big " + s2; 
// Message contains "This is a big test".
 

At least one argument to the concatenation operators (+ or +=) must be a CString object, but you can use a constant character string (such as "big") or a char (such as \’x\’) for the other argument.

改为 CString message = s1 + L"big " + s2; 

rror C2678: binary \’+\’ : no operator found which takes a left-hand operand of type \’const char [2]\’ (or there is no acceptable conversion)
2>        O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\atlsimpstr.h(667): could be \’ATL::CSimpleStringT<BaseType> ATL::CSimpleStringT<BaseType>::operator +(const ATL::CSimpleStringT<BaseType> &,const ATL::CSimpleStringT<BaseType> &)\’ [found using argument-dependent lookup]
2>        with
2>        [
2>            BaseType=TCHAR
2>        ]
2>        O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\atlsimpstr.h(678): or \’ATL::CSimpleStringT<BaseType> ATL::CSimpleStringT<BaseType>::operator +(const ATL::CSimpleStringT<BaseType> &,const wchar_t *)\’ [found using argument-dependent lookup]
2>        with
2>        [
2>            BaseType=TCHAR
2>        ]
2>        O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\atlsimpstr.h(689): or \’ATL::CSimpleStringT<BaseType> ATL::CSimpleStringT<BaseType>::operator +(const wchar_t *,const ATL::CSimpleStringT<BaseType> &)\’ [found using argument-dependent lookup]
2>        with
2>        [
2>            BaseType=TCHAR
2>        ]
2>        O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2316): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(const ATL::CStringT<BaseType,StringTraits> &,const ATL::CStringT<BaseType,StringTraits> &)\’ [found using argument-dependent lookup]
2>        with
2>        [
2>            BaseType=wchar_t,
2>            StringTraits=StrTraitMFC<wchar_t>
2>        ]
2>        O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2325): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(const ATL::CStringT<BaseType,StringTraits> &,const wchar_t *)\’ [found using argument-dependent lookup]
2>        with
2>        [
2>            BaseType=wchar_t,
2>            StringTraits=StrTraitMFC<wchar_t>
2>        ]
2>        O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2334): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(const wchar_t *,const ATL::CStringT<BaseType,StringTraits> &)\’ [found using argument-dependent lookup]
2>        with
2>        [
2>            BaseType=wchar_t,
2>            StringTraits=StrTraitMFC<wchar_t>
2>        ]
2>        O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2343): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(const ATL::CStringT<BaseType,StringTraits> &,wchar_t)\’ [found using argument-dependent lookup]
2>        with
2>        [
2>            BaseType=wchar_t,
2>            StringTraits=StrTraitMFC<wchar_t>
2>        ]
2>        O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2353): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(const ATL::CStringT<BaseType,StringTraits> &,char)\’ [found using argument-dependent lookup]
2>        with
2>        [
2>            BaseType=wchar_t,
2>            StringTraits=StrTraitMFC<wchar_t>
2>        ]
2>        O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2363): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(wchar_t,const ATL::CStringT<BaseType,StringTraits> &)\’ [found using argument-dependent lookup]
2>        with
2>        [
2>            BaseType=wchar_t,
2>            StringTraits=StrTraitMFC<wchar_t>
2>        ]
2>        O:\\ms\\vs8\\VC\\ce\\atlmfc\\include\\cstringt.h(2373): or \’ATL::CStringT<BaseType,StringTraits> ATL::CStringT<BaseType,StringTraits>::operator +(char,const ATL::CStringT<BaseType,StringTraits> &)\’ [found using argument-dependent lookup]
2>        with
2>        [
2>            BaseType=wchar_t,
2>            StringTraits=StrTraitMFC<wchar_t>
2>        ]
2>        while trying to match the argument list \’(const char [2], CString)\’

标签:, , , , ,
20070718 vs2003 安装 SETUP INSTALL 25003 error - 十二月 19, 2007 by yippee

20070718 vs2003 安装 SETUP INSTALL 25003 error
http://www.yippeesoft.com

以前安装OK,今天居然失败。
发现原因
以前用DTOOLS虚拟光驱,可以共享
现在用VCdControlTool.exe 居然不能共享
因此把ISO解压了,结果没有映射
微软的程序经常这样,没有在根目录下就有问题

安装VS.net 2003时发生错误(ERROR: 内部错误 2337)的解决方法
在困惑了两天两夜,使用google搜索了所有能搜到的相关错误信息的网页,始终未果。
把XP所有的补丁打了几遍,把XP重装两遍,俄版的,大上海版的。
又装了windows server 2003,还是报如下错误:
[03/19/04,13:42:05] Visual Studio .NET Enterprise Architect 2003 – CHS: [2] ERROR: 内部错误 2337。
[03/19/04,13:45:13] Visual Studio .NET Enterprise Architect 2003 – CHS: [2] ERROR processed; exception was thrown for retail build
 Developer Comment:  操作启动消息顺序不对
 Build Time:  Thu Feb 15 17:56:18 2001
 HRESULT:  -2147467259
[03/19/04,13:46:01] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InstallManagerHelper()
[03/19/04,13:46:01] setup.exe: [2] Component error string not specified in ISetupManager::AddToActionResultCollection()

高分求救:XP下安装VS2003出错(正在执行操作:CreateVSDevGroup 内部错误 25003。)
 
 

XP下安装VS2003,第一项准备已经装好,但装VS时出错。我开始以为是XP系统不好,重新装了一次XP,刚装好的新系统就开始装VS,还有分别重装了三次不同的虚拟光驱软件,最后还都是出一样的错误:

正在执行操作:CreateVSDevGroup
内部错误 25003。

到底是什么问题啊?是操作系统还是VS软件?这个VS2003我同学在WIN2003下装过,没问题。

错误日志:

[01/28/05,12:11:51] Visual Studio .NET Enterprise Architect 2003 – CHS: [2] ERROR: 内部错误 25003。
[01/28/05,12:11:54] Visual Studio .NET Enterprise Architect 2003 – CHS: [2] ERROR: 内部错误 25003。
[01/28/05,12:12:07] setup.exe: [2] ISetupComponent::Pre/Post/Install() failed in ISetupManager::InstallManagerHelper()
[01/28/05,12:12:07] setup.exe: [2] Component error string not specified in ISetupManager::AddToActionResultCollection()
 

 have WinXP & brand new HP PC.
I have the MSDN Uinviseral Subscription
So I downloaed the DVD full install eng ed
of VS 2003.NET Enterprise Edition.
I followed all the setup instrucitons about
seting up IIS on XP and FP ext. etc.

I did a Windows Update. (but skipped XP sp2)

I got the Prereqs installed.
Then went on to step 2 in VS install
I selected a diffrent drive (becuase my system drive only
has 10 GB free and I dont want to fill that up)
I selected all the check boxes so none are grey to get
a "Full Install".

The install starts but about 3 minutes in I get "Internal
Error 25003" popup
window.

As you can see below, my vsinstall71.txt
shows "failed to find global prop in
CUIMgr::GetGlobalProperty()"
I found no help on the web or microsoft.com
on this error.

OK I tried using the dos command subst to create a V:
drive to start where the setup.exe is.
subst V: F:\\apps\\VSENARD1

And as I run that command, the auto start runs setup.

安装 MicrosoftVisualStudio.NET, 时出现 " 安装 Error 25003 " 错误信息。 如果文件不正确复制安装过程中可能会发生此问题。
有关如何解决安装错误 25003 提示
下面是各种方法来解决此问题:• 请确保已与使用 (如 CD-ROM) 安装媒体未损坏。

有关其他信息, 请单击下列文章编号以查看 Microsoft 知识库中相应:
284230 (http://support.microsoft.com/kb/284230/) INFO: 替换损坏或有缺陷 VisualStudio 产品磁盘 
• 确保不出现任何问题 (如防病毒程序) 上安装的其他程序。 如果是 VisualStudio.NET 安装程序时运行防病毒程序或运行 Microsoft.NET 框架安装, 安装可能失败。

有关其他信息, 请单击下列文章编号以查看 Microsoft 知识库中相应:
330733 (http://support.microsoft.com/kb/330733/) PRB: 当病毒 Visual Studio NET 2003 安装程序可能失败或防火墙程序正在运行 
• 如果从 CD-ROM, 安装 VisualStudio.NET 将的 CD-ROM 内容复制到硬盘, 然后从硬盘启动安装。 
• 如果您有多个 CD-ROM 驱动器, 尝试从不同 CD-ROM 驱动器启动的 VisualStudio.NET 安装。 
• 确保可以从安装 CD-ROM, CD-ROM 驱动器正确读取数据。 
• 如果您尝试从共享 CD-ROM 驱动器运行到其它计算机, 安装通过网络安装可能失败。 将安装文件复制到硬盘, 然后从硬盘运行安装程序通过网络。
 
为网络安装创建 .ini 文件
必须根据要安装的 Visual Studio .NET 功能为网络安装创建一个 .ini 文件。安装程序使用此 .ini 文件在网络计算机上安装 Visual Studio .NET。要为网络安装创建 .ini 文件,请按照下列步骤操作: 1. 插入 Visual Studio .NET CD 1 或 DVD,并忽略自动运行消息。
2. 单击“开始”,然后单击“运行”。
3. 键入下面的命令,然后单击“确定”。
N:\\setup\\Setup.exe /createunattend PathToIniFile
例如:
D:\\setup\\Setup.exe /createunattend c:\\vs7_deployment.ini
4. 在“Microsoft Visual Studio .NET 管理员模式”对话框中,单击“接受协议”以接受《最终用户许可协议》,在“产品密钥”框中键入 25 位的产品密钥,然后单击“继续”。

注意:产品密钥在 CD 包装上。
5. 在 Select items to install(选择要安装的项)下,选择要在网络计算机上安装的项,然后单击“保存设置”。
6. 保存 .ini 文件后,单击“完成”。

标签:, , , , , ,
20070711 WEB SERVICE 代理类 proxy wsdl error CS0234 - 十二月 12, 2007 by yippee

20070711 WEB SERVICE 代理类 proxy wsdl error CS0234
http://www.yippeesoft.com

Web Service体系结构包含了三个角色:服务提供者(Service provider)、服务代理者(Service broker)和服务请求者(Service request)。服务提供者提供可通过网络访问的软件模块(Web 服务的一个商业处理功能),并通过 WSDL描述服务中所含的功能、要使用此功能所需输入的数据,以及预期的输出结果。服务提供者把它发布到服务代理者。服务代理者的核心是UDDI数据库,它允许服务提供者公告服务内容并使服务请求者能找到这些服务。服务请求者使用查找操作来从本地或服务代理者处检索服务描述,然后使用服务描述与服务提供者进行绑定并调用Web Service 功能。

 Web服务代理是支持.net的编程语言文件,由.net框架提供的WSDL工具自动生成。代理类不包含任何应用程序逻辑。相反,他包含关于如何传递参数和检索结果的传输逻辑,还包含Web服务中的方法及原型列表。代理类可以从任何WSDL文件创建。
       可以像访问com对象一样访问Web服务。要访问Web服务,需要从本地计算机上的Web服务的WSDL文档创建代理类。.net提供了名为WSDL.exe的工具以自动生成代理类文件。下面详细说明其创建和使用过程:

一个WEB SERVICE,原来使用呢自己做的工具生成DLL文件,好像使用呢System.CodeDom 命名空间包含可以用于表示源代码文档的元素和结构的类。此命名空间中的类可用来建立源代码文档结构的模型,使用 System.CodeDom.Compiler 命名空间提供的功能可以将源代码文档输出为所支持语言的源代码。

根据网上的说法
call "O:\\ms\\VS7\\Common7\\Tools\\vsvars32.bat"
wsdl http://localhostsf.WebService/Ordersf.asmx /n:sf.method
csc /out:Bridge_sf.dll /t:library /r:System.Web.Services.dll sf.cs

生成呢CS文件,也看到了,可就是编译不能通过,报告
 error CS0246: 找不到类型或命名空间名称“add”(是否缺少 using 指令或程序集引用?)

 郁闷,使用对象浏览器也看不到几个方法

对方给你的url只要能返回一份wsdl文档就可以了,asmx那些后缀只是不同的服务实现而已。
有了这个url,最简单的做法是通过studio.net的添加web引用-输入url,如果url正确的话则studio直接会生成相关的代理类,然后在程序中直接引用就可以了。

资料:
1、  新建一个asp应用程序(#C)工程,工程名为TeachShow,在TeachShow工程中创建一个文件夹Charpter8,在该文件夹下创建一个新的Web服务,取名为:Computer.asmx

2、  切换到代码视图,编写下面的代码:
[WebMethod(Description="用于相加运算", EnableSession=false)]
        public int Add(int a,int b)
        &leftsign;
            return a+b;
        &rightsign;

3、按F5编译整个工程(这一步一定要做,如果不做第4步无法实现)
4、打开MS.net 2003的命令提示工具,输入:C:\\>wsdl http://localhost/TeachShow/Charpter8/FirstAndUse/Computer.asmx  /n:ComputerNameSpace,其中,ComputerNameSpace是自定义的命名空间。提示如下:
Microsoft (R) Web 服务描述语言实用工具
[Microsoft (R) .NET Framework,版本 1.1.4322.573]
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
正在写入文件“C:\\Computer.cs”。
5、注意,此时在C:盘(其实就是命令提示符的当前目录)下生成一个和Computer.asmx相同文件名的C#源文件Computer.cs。
6、编译Computer.cs文件,在命令提示符下输入如下命令:C:\\>csc /out:ComputerDll.dll /t:library /r:System.Web.Services.dll c:\\Computer.cs。其中,/out:ComputerDll.dll是要输出的dll文件,/t:library是输出文件类型,/r:System.Web.Services.dll是要引用的组件,c:\\Computer.cs是第4步生成的C#文件。
7、此时,将会在C:盘下生成一个叫ComputerDll.dll的文件,要使用这个文件,必须复制到TeachShow文件夹下的bin目录下。默认情况下为:C:\\Inetpub\\wwwroot\\TeachShow\\bin。
8、新建一个名为TestWSDL.aspx的WEB窗体文件,并添加一个引用,将刚才生成的ComputerDll.dll文件作为引用添加到工程中。
9、在TestWSDL.aspx窗体的Load事件中编写代码:
                     ComputerNameSpace.Computer com=new ComputerNameSpace.Computer();
            this.Response.Write("和:"+com.Add(45,65).ToString()+"");

动态调用Web Service
//其实就是先获得Web Service的WSDL,然后生产代理类,把代理类加入到CodeDOM中建立源码,然后执行创建CSharp(或其他)编译器编译执行。
/// <summary>
  /// 根据指定的信息,调用远程WebService方法
  /// </summary>
  /// <param name=url>WebService的http形式的地址</param>
  /// <param name=namespace>欲调用的WebService的命名空间</param>
  /// <param name=classname>欲调用的WebService的类名(不包括命名空间前缀)</param>
  /// <param name=methodname>欲调用的WebService的方法名</param>
  /// <param name=args>参数列表</param>
  /// <returns>WebService的执行结果</returns>
  /// <remarks>
  /// 如果调用失败,将会抛出Exception。请调用的时候,适当截获异常。
  /// 异常信息可能会发生在两个地方:
  /// 1、动态构造WebService的时候,CompileAssembly失败。
  /// 2、WebService本身执行失败。
  /// </remarks>
  /// <example>
  /// <code>
  /// object obj = InvokeWebservice(http://localhost/GSP_WorkflowWebservice/common.asmx,Genersoft.Platform.Service.Workflow,Common,GetToolType,new object[]&leftsign;1&rightsign;);
  /// </code>
  /// </example>
  public static object InvokeWebservice(string url, string @namespace, string classname, string methodname, object[] args)
  &leftsign;       
   try
   &leftsign;
    //提供向 URI 标识的资源发送数据和从 URI 标识的资源接收数据的公共方法。不能继承此类。
    System.Net.WebClient wc = new System.Net.WebClient();
    //为从具有指定 URI 的资源下载的数据打开一个可读的流。
    System.IO.Stream stream = wc.OpenRead(url+"?WSDL");
    //提供一种方法,以创建和格式化用于描述 XML Web services 的有效的 Web 服务描述语言 (WSDL) 文档文件。该文件是完整的,具有适当的命名空间、元素和属性。无法继承此类。
    //read已重载。通过直接加载 XML 来初始化 ServiceDescription 类的实例。
    System.Web.Services.Description.ServiceDescription sd = System.Web.Services.Description.ServiceDescription.Read(stream);
    //公开一种为 XML Web services 生成客户端代理类的方法。
    System.Web.Services.Description.ServiceDescriptionImporter sdi = new System.Web.Services.Description.ServiceDescriptionImporter();
    //将指定的 ServiceDescription 添加到 ServiceDescriptions 集合。
    sdi.AddServiceDescription(sd, "","");

    //System.CodeDom 命名空间包含可以用于表示源代码文档的元素和结构的类。此命名空间中的类可用来建立源代码文档结构的模型,使用 System.CodeDom.Compiler 命名空间提供的功能可以将源代码文档输出为所支持语言的源代码。
    //表示命名空间声明。
    System.CodeDom.CodeNamespace cn = new System.CodeDom.CodeNamespace(@namespace);
    //为 CodeDOM 程序图形提供容器
    //可以存储包含 CodeDOM 源代码图形的 CodeNamespace 对象的集合、项目引用的程序集的集合,以及项目程序集的属性集合。
    System.CodeDom.CodeCompileUnit ccu = new System.CodeDom.CodeCompileUnit();
    //获取命名空间的集合。
    ccu.Namespaces.Add(cn);

    //从指定的命名空间导入 ServiceDescription,并生成客户端代理类的代码。
    sdi.Import(cn,ccu);

    //提供对 C# 代码生成器和代码编译器的实例的访问
    Microsoft.CSharp.CSharpCodeProvider csc = new Microsoft.CSharp.CSharpCodeProvider();
    //获取 C# 代码编译器的实例
    System.CodeDom.Compiler.ICodeCompiler icc = csc.CreateCompiler();

    //
    System.CodeDom.Compiler.CompilerParameters cplist = new System.CodeDom.Compiler.CompilerParameters();
    //
    cplist.GenerateExecutable = false;
    //
    cplist.GenerateInMemory = true;
    cplist.ReferencedAssemblies.Add("System.dll");
    cplist.ReferencedAssemblies.Add("System.XML.dll");
    cplist.ReferencedAssemblies.Add("System.Web.Services.dll");
    cplist.ReferencedAssemblies.Add("System.Data.dll");
    cplist.
    //
    System.CodeDom.Compiler.CompilerResults cr = icc.CompileAssemblyFromDom(cplist, ccu);
    if(true == cr.Errors.HasErrors)
    &leftsign;
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     foreach(System.CodeDom.Compiler.CompilerError ce in cr.Errors)
     &leftsign;
      sb.Append(ce.ToString());
      sb.Append(System.Environment.NewLine);
     &rightsign;
     throw new Exception(sb.ToString());
    &rightsign;
    System.Reflection.Assembly assembly = cr.CompiledAssembly;
    Type t = assembly.GetType(@namespace+"."+classname,true,true);
    //
    object obj = Activator.CreateInstance(t);
    System.Reflection.MethodInfo mi = t.GetMethod(methodname);
    return mi.Invoke(obj,args);
   &rightsign;
   catch(Exception ex)
   &leftsign;
    throw new Exception(ex.InnerException.Message,new Exception(ex.InnerException.StackTrace));
   &rightsign;
  &rightsign;

标签:, , , , ,

20070117 XML Error C00CE508 - 六月 21, 2007 by yippee

20070117 XML Error C00CE508
WWW.SHENGFANG.ORG

XML Error C00CE508 文本内容发现无效内容
Hello,
I try to transform the file xml.xml with the xsl-file xsl.xsl to the file csv.csv.

When I run the command line "msxsl.exe xml.xml xsl.xsl >csv.csv" everything is sweet. If I try to do the same via C++ and DOM, I get:
URL:   <– Empty !!!
Line: 1
Character: 148
Error[ c00ce508 ]: An invalid character was found in text content.

The code for the Console-MFC application comes in the next post.
I\’m using ADO recordset Save method to spit the result into XML format and then feeding the resultant XML to XMLDOMObject to display the data based on XSL.

Here the issue is – one of the field having a text value with \’1/2\’ and \’3/4\’ symbols in it. XML parser complains that \’An invalid character was found in text content\’ with Error code \’C00CE508\’
为啥俺的XML文件不支持中文?提示为“无效字符”
你把<xml version="1.0" encoding="UTF-8">改成<xml version="1.0" encoding="GB2312">
就可以了.
  其实用<? xml version="1.0" encoding="UTF-8" ?>也可以是中文。
只是节点名不能是中文..  用<?xml version="1.0" encoding="gb2312" ?>
的话节点名就可以是中文了..

// XMLTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "XMLTest.h"

#include <TCHAR.H>
#include <stdio.h>
#include <time.h>

#import "msxml4.dll"

#include "..\\PMKUtils\\MSXML4\\inc\\msxml2.h"

using namespace MSXML2;

inline void EVAL_HR( HRESULT _hr )
   &leftsign; if FAILED(_hr) throw(_hr); &rightsign;

class CMSXMLTransformer 
&leftsign;
public:
     CString m_sError;
     void printMSXMLError(const IXMLDOMDocument2Ptr& pXMLDoc);
     _variant_t loadDocument(IXMLDOMDocument2Ptr& pXMLDoc, LPCTSTR szDocURL, bool bOverHTTP);
     static bool isMSXMLInstalled();
     CMSXMLTransformer();
     virtual ~CMSXMLTransformer();
    bool transform( const CString & sXMLSource, const CString & sXSLTScript, const CString & sOutput );
&rightsign;;

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object

CWinApp theApp;

using namespace std;

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMSXMLTransformer::CMSXMLTransformer()
&leftsign;

&rightsign;

CMSXMLTransformer::~CMSXMLTransformer()
&leftsign;

&rightsign;

//——————————————————————
//
//     Check if MSXML 4.0 is installed.
//
//——————————————————————
bool CMSXMLTransformer::isMSXMLInstalled()
&leftsign;
     try
     &leftsign;
        _TCHAR   szTemp[ _MAX_PATH ];
          HKEY hKey;
          DWORD retCode, dwLen;

          retCode = RegOpenKeyEx(HKEY_CLASSES_ROOT,
                              _T("CLSID\\\\&leftsign;88d969c0-f192-11d4-a65f-0040963251e5&rightsign;\\\\InProcServer32"),
                              0,
                              KEY_QUERY_VALUE,
                              &hKey);

          if (retCode != ERROR_SUCCESS) return false;

          retCode = RegQueryValueEx(hKey, _T(""), NULL, NULL, (LPBYTE)szTemp, &(dwLen = sizeof(szTemp)));

          if (retCode != ERROR_SUCCESS) return false;

          RegCloseKey(hKey);

          double dVer;
          int i;

          for (i = _tcslen(szTemp); i >= 0; –i)
          &leftsign;
               if (szTemp[i] == _T(\’\\\\\’))
                    break;
          &rightsign;

          if (_stscanf(szTemp + i + 1, _T("msxml%lf"), &dVer) == 0 &line;&line; dVer < 4.0)
          &leftsign;
               _ftprintf(stderr, _T("\\nError: MSXML 4.0 is not installed. Exiting.\\n"));
               return false;
          &rightsign;
          else
          &leftsign;
               return true;
          &rightsign;
     &rightsign;
     catch(…)
     &leftsign;//Exception handling
     &rightsign;
    
     return false;
&rightsign;

//——————————————————————
//
//     Load the XML document using DOM
//
//——————————————————————
_variant_t CMSXMLTransformer::loadDocument(IXMLDOMDocument2Ptr &pXMLDoc, LPCTSTR szDocURL, bool bOverHTTP)
&leftsign;
     _variant_t varLoadResult((bool)FALSE);

     try
     &leftsign;
          //     Create MSXML DOM object
          EVAL_HR(pXMLDoc.CreateInstance("Msxml2.DOMDocument.4.0"));
    
          //     Load the document synchronously
          pXMLDoc->async = false;
        pXMLDoc->validateOnParse = true;

          if( bOverHTTP)
          &leftsign;
               //     If loading the document over HTTP (see KB Q321125 for details)
            pXMLDoc->setProperty("ServerHTTPRequest", VARIANT_TRUE);
          &rightsign;
         

          //     Load the XML document
          varLoadResult = pXMLDoc->load(szDocURL);
     &rightsign;
     catch(…)
     &leftsign;//Exception handling
        ASSERT( false );
     &rightsign;

     return varLoadResult;
&rightsign;

//——————————————————————
//
//     Uses DOMDocument parseError to print the error message
//
//——————————————————————
void CMSXMLTransformer::printMSXMLError(const IXMLDOMDocument2Ptr &pXMLDoc)
&leftsign;
     try
     &leftsign;
          //     Get parseError interface
          IXMLDOMParseErrorPtr pError = NULL;
          EVAL_HR(pXMLDoc->get_parseError(&pError));
        m_sError = (const char *)pError->reason;
        DWORD dwLine = (DWORD) pError->line;
        DWORD dwLinePos = (DWORD) pError->linepos;
        DWORD dwCode = (DWORD)pError->errorCode;
        CString sFile;
        sFile = (const char *)pError->url;

        if( dwCode != 0 )
        &leftsign;
            m_sError.Format(
                "URL: %s\\nLine: %ld\\nCharacter: %ld\\nError[ %08x ]: %s",
                sFile,
                dwLine,
                dwLinePos,
                dwCode,
                (const char*) pError->reason );
            TRACE( m_sError );
        &rightsign;
     &rightsign;
     catch(…)
     &leftsign;//Exception handling
        ASSERT( false );
     &rightsign;
&rightsign;

bool CMSXMLTransformer::transform( const CString & sXMLSource, const CString & sXSLTScript, const CString & sOutput )
&leftsign;
    bool bRes = false;

     try
     &leftsign;
          EVAL_HR(CoInitialize(NULL));

          //     Make sure that MSXML 4.0 is installed
          if (!isMSXMLInstalled())
               return false;

         
          IXMLDOMDocument2Ptr pXMLDoc = NULL;
          IXMLDOMDocument2Ptr pXSLDoc = NULL;
         

          //     Load the XML document
          if (loadDocument(pXMLDoc, sXMLSource, true))
          &leftsign;
               //     Load the stylesheet
               if (loadDocument(pXSLDoc, sXSLTScript, false))
               &leftsign;
                    //     The source XML document DOM object is reused to hold
                    //     the transformed XML. Get the dispatch interface to do this.
                    VARIANT vObject;
                    IDispatch *pDisp;
                LPCTSTR pOutput = sOutput;

                    EVAL_HR(pXMLDoc->QueryInterface(IID_IDispatch, (void **)&pDisp));
                    vObject.vt = VT_DISPATCH;
                    vObject.pdispVal = pDisp;

                    //     Apply the transformation
                    EVAL_HR(pXMLDoc->transformNodeToObject(pXSLDoc, &vObject));

                printMSXMLError(pXMLDoc);
                if( bRes = m_sError == "" )
                &leftsign;
                        pXMLDoc->save( pOutput );
                &rightsign;
               &rightsign;
               else
               &leftsign;
                    printMSXMLError(pXSLDoc);
               &rightsign;

          &rightsign;
          else
          &leftsign;
               printMSXMLError(pXMLDoc);
          &rightsign;
     &rightsign;
     catch(…)
     &leftsign;//exception handling
        ASSERT( FALSE );
     &rightsign;
    
     CoUninitialize();
    return bRes;
&rightsign;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
&leftsign;
     int nRetCode = 0;

     // initialize MFC and print and error on failure
     if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
     &leftsign;
          // TODO: change error code to suit your needs
          cerr << _T("Fatal Error: MFC initialization failed") << endl;
          nRetCode = 1;
     &rightsign;
     else
     &leftsign;
          // TODO: code your application\’s behavior here.
          CString strHello;
          strHello.LoadString(IDS_HELLO);
          cout << (LPCTSTR)strHello << endl;

        CMSXMLTransformer Transformer;

        Transformer.transform( "xml.xml", "xsl.xsl", "csv.csv" );

        if( Transformer.m_sError != "" )
        &leftsign;
            AfxMessageBox( Transformer.m_sError );
        &rightsign;
     &rightsign;

     return nRetCode;
&rightsign;

标签:, , ,

1102 VC6 VC7 error C2440 AVI - 四月 10, 2007 by yippee

1102 VC6 VC7 error C2440 AVI

error C2440: “static_cast” 无法从“void (__thiscall CChatManagerDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )
VC7就以后版本要求自定义消息的原型是  
  LRESULT   MessageHandler(WPARAM,LPARAM);  
  注意,如果是void   MessageHandler(WPARAM,LPARAM),在以前的版本中虽然不提示编译错误,但运行时也会出问题的。

消息响应函数是要有long型返回值的,
VC++6允许你用void型返回值,并不表示你这样做是正确的,
VC++.NET增加了这一项安全检查,不再允许void返回值。
你把返回值改为RESULT型就可以了,
RESULT在32位下就是long,在64位下是int 64。

typedef struct _avistreamheader &leftsign;
     FOURCC fcc;  // 必须为‘strh’
     DWORD  cb;   // 本数据结构的大小,不包括最初的8个字节(fcc和cb两个域)
FOURCC fccType;    // 流的类型:‘auds’(音频流)、‘vids’(视频流)、
                   //‘mids’(MIDI流)、‘txts’(文字流)
     FOURCC fccHandler; // 指定流的处理者,对于音视频来说就是解码器
     DWORD  dwFlags;    // 标记:是否允许这个流输出?调色板是否变化?
     WORD   wPriority;  // 流的优先级(当有多个相同类型的流时优先级最高的为默认流)
     WORD   wLanguage;
     DWORD  dwInitialFrames; // 为交互格式指定初始帧数
     DWORD  dwScale;   // 这个流使用的时间尺度
     DWORD  dwRate;
     DWORD  dwStart;   // 流的开始时间
     DWORD  dwLength;  // 流的长度(单位与dwScale和dwRate的定义有关)
     DWORD  dwSuggestedBufferSize; // 读取这个流数据建议使用的缓存大小
     DWORD  dwQuality;    // 流数据的质量指标(0 ~ 10,000)
     DWORD  dwSampleSize; // Sample的大小
     struct &leftsign;
         short int left;
         short int top;
         short int right;
         short int bottom;
&rightsign;  rcFrame;  // 指定这个流(视频流或文字流)在视频主窗口中的显示位置
             // 视频主窗口由AVIMAINHEADER结构中的dwWidth和dwHeight决定
&rightsign; AVISTREAMHEADER;

typedef struct _avimainheader &leftsign;
    FOURCC fcc;   // 必须为‘avih’
    DWORD  cb;    // 本数据结构的大小,不包括最初的8个字节(fcc和cb两个域)
    DWORD  dwMicroSecPerFrame;   // 视频帧间隔时间(以毫秒为单位)
    DWORD  dwMaxBytesPerSec;     // 这个AVI文件的最大数据率
    DWORD  dwPaddingGranularity; // 数据填充的粒度
    DWORD  dwFlags;         // AVI文件的全局标记,比如是否含有索引块等
    DWORD  dwTotalFrames;   // 总帧数
    DWORD  dwInitialFrames; // 为交互格式指定初始帧数(非交互格式应该指定为0)
    DWORD  dwStreams;       // 本文件包含的流的个数
    DWORD  dwSuggestedBufferSize; // 建议读取本文件的缓存大小(应能容纳最大的块)
    DWORD  dwWidth;         // 视频图像的宽(以像素为单位)
    DWORD  dwHeight;        // 视频图像的高(以像素为单位)
    DWORD  dwReserved[4];   // 保留
&rightsign; AVIMAINHEADER;

859189837   =mmioFOURCC(\’M\’,\’2\’,\’6\’,\’3\’);  
   
  #ifndef   MKFOURCC  
  #define   MKFOURCC(   ch0,   ch1,   ch2,   ch3   )                                                                         \\  
  (   (DWORD)(BYTE)(ch0)   &line;   (   (DWORD)(BYTE)(ch1)   <<   8   )   &line; \\  
  (   (DWORD)(BYTE)(ch2)   <<   16   )   &line;   (   (DWORD)(BYTE)(ch3)   <<   24   )   )  
  #endif  
   
  #if   !defined(_INC_MMSYSTEM)  
          #define   mmioFOURCC   MKFOURCC  
  #endif  
   

标签:, , , , ,
20070628 skyeye uclinux make error - 三月 12, 2007 by yippee

20070628 skyeye uclinux make error
http://www.yippeesoft.com
 
PING 10.0.0.1 (10.0.0.1): 56 data bytes
NumInstr 45792648, io_read_word unknown addr(0xfffff10c) = 0xffffffff
R c90,4f8b588f,2710,fffff10f,20000013,13d3f98,13d3f98,13d2000,100baa0,4e,13c0004,0,2710,13d3f8c,100f0b4,100f268,C 20000093,S 0,0,60000093,20000000,0,0,0,M 13,B 3,E 0,I 0,P 14ed70c,T 0,L e3740a01,D e1a04000,skyeye: write data to nic is bigger than 256
R 2a,10e5ce4,fffa0000,ffffffa2,1176260,1179120,1179120,11396c0,10e5ce4,100000a,200000a,0,11e,10dfe88,1082640,1072770,C 13,S 0,0,60000093,60000013,0,0,0,M 13,B 3,E 0,I 0,P 100c63c,T 0,L e3530000,D e5953000,skyeye: write data to nic is bigger than 256
R fffa0fff,fffa0000,ffffffa2,26,fffa001f,1179120,3c,11396c0,0,100000a,200000a,0,40,10dfe88,10727e4,1072824,C 20000013,S 0,0,20000093,20000013,0,0,0,M 13,B 3,E 0,I 0,P 107281c,T 0,L e5503003,D e2400d3f,

sim_info called

Program received signal SIGINT, Interrupt.
0×0100c648 in arch_idle () at current.h:7

Program received signal SIGINT, Interrupt.
0×01002868 in setup_arch (cmdline_p=0×10dffd8) at setup.c:148
148                     printk("CPU configuration botched (ID %08x), unable "

Welcome to
          ____ _  _
         /  __&line; &line;&line;_&line;                
    _   _&line; &line;  &line; &line; _ ____  _   _  _  _
   &line; &line; &line; &line; &line;  &line; &line;&line; &line;  _ \\&line; &line; &line; &line;\\ \\/ /
   &line; &line;_&line; &line; &line;__&line; &line;&line; &line; &line; &line; &line; &line;_&line; &line;/    \\
   &line;  ___\\____&line;_&line;&line;_&line;_&line; &line;_&line;\\____&line;\\_/\\_/
   &line; &line;
   &line;_&line;

GDB/ARMulator support by <davidm@snapgear.com>
For further information check:
http://www.uclinux.org/

Command: /bin/ifconfig eth0 up 10.0.0.2
Execution Finished, Exiting
NumInstr 5454093, io_read_word unknown addr(0xfffff10c) = 0xffffffff
R d7c,4f8b588f,2710,fffff10f,80000013,1137f88,11e0e7c,1136000,100baa0,d,11e0004,0,2710,1137f7c,100f0b4,100f268,C 80000093,S 0,0,20000093,40000000,0,0,0,M 13,B 3,E 0,I 0,P 14957e8,T 0,L e1a04000,D e3700a01,NumInstr 5466209, io_read_word unknown addr(0xfffff10c) = 0xffffffff
R a83,4f8b588f,2710,fffff10f,80000013,1137f88,11e0e7c,1136000,100baa0,d,11e0004,0,2710,1137f7c,100f0b4,100f268,C 80000093,S 0,0,20000093,40000000,0,0,0,M 13,B 3,E 0,I 0,P 14957e8,T 0,L e1a04000,D e3700a01,NumInstr 5666999, io_read_word unknown addr(0xfffff10c) = 0xffffffff
R 60,4f8b588f,2710,fffff10f,80000013,1137f88,15c,1136000,100baa0,d,11e0004,0,2710,1137f7c,100f0b4,100f268,C 80000093,S 0,0,40000093,0,0,0,0,M 13,B 3,E 0,I 0,P 14957e8,T 0,L e1a04000,D e3700a01,NumInstr 5667145, io_read_word unknown addr(0xfffff10c) = 0xffffffff
R 56,4f8b588f,2710,fffff10f,80000013,1137f88,0,1136000,100baa0,d,11e0004,0,2710,1137f7c,100f0b4,100f268,C 80000093,S 0,0,40000093,60000000,0,0,0,M 13,B 3,E 0,I 0,P 14957e8,T 0,L e1a04000,D e3700a01,
Sash command shell (version 1.1.1)
/> NumInstr 5908427, io_read_word unknown addr(0xfffff10c) = 0xffffffff
R 1359,4f8b588f,2710,fffff10f,80000013,1137f88,9,1136000,100baa0,d,11e0004,0,2710,1137f7c,100f0b4,100f268,C 80000093,S 0,0,80000093,60000000,0,0,0,M 13,B 3,E 0,I 0,P 14957e8,T 0,L e1a04000,D e3700a01,

Program received signal SIGINT, Interrupt.
0×01013210 in panic (fmt=0×10c6bf4 "VFS: Unable to mount root fs on %s") at panic.c:106
106             sti();

[root@mobile skyeye]# ../skyeye_1_2_2_Rel/binary/skyeye -e linux  
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name at91, mach_init addr 0×805eb94
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
can\’t find device module: (null)
log_info: log is off.
log_info:log file is /tmp/test.log, fd is 0×813ad80
log_info: log start clock 3200000
log_info: log end clock 3330000
uart_mod:0, desc_in:, desc_out:
SKYEYE: use arm7100 mmu ops
Loaded ROM   ./boot.rom
exec file "linux"\’s format is elf32-little.
load section .init: addr = 0×01000000  size = 0×0000a000.
load section .text: addr = 0×0100a000  size = 0×000c8540.
load section .data: addr = 0×010d4000  size = 0×00008864.
not load section .bss: addr = 0×010dc880  size = 0×00020f10 .
not load section .comment: addr = 0×00000000  size = 0×000010e0 .
not load section .debug_abbrev: addr = 0×00000000  size = 0×0003a17a .
not load section .debug_info: addr = 0×00000000  size = 0×00aa85e3 .
not load section .debug_line: addr = 0×00000000  size = 0×000a4361 .
not load section .debug_pubnames: addr = 0×00000000  size = 0×0000bfd7 .
not load section .debug_aranges: addr = 0×00000000  size = 0×00002248 .
not load section .debug_str: addr = 0×00000000  size = 0×00022ed2 .
not load section .debug_frame: addr = 0×00000000  size = 0×00015620 .
not load section .debug_ranges: addr = 0×00000000  size = 0×000108d0 .
start addr is set to 0×01000000 by exec file.

标签:, , , , , , ,
0804 Error Invoking ATL Object Wizard Component - 一月 13, 2007 by yippee

0804 Error Invoking ATL Object Wizard Component

郁闷,看了很多ATL COM编程
结果VC报告这个

卸载重装几次,还是如此 最后怀疑是不是中文路径名问题,改为全英文目录,OK。晕倒

为什么我选择Insert/New ATL Object会出现Error Invoking ATL Object Wizard Component

我在进行"新建ATL对象"的时候,提示错误信息:"Error Invoking ATL Object wizard Component"的消息框.意思应该是说向导出错.急

Converting a Win32 Application to ATL
In the midst of all this publicity writing ATL-based applications, you will find little in the way of documentation on porting your legacy Win32 applications to ATL. Hopefully, these steps will ease that migration path.

Migration Steps
Include AtlBase.h file in StdAfx.h after AfxWin.h. This is to take advantage to declare a variable for CComModule. Because AtlWin.h file needs, _Module as variable of CComModule.
#include <atlbase.h>
#include <objbase.h>

We have to keep extern because we are originally declaring variable in Application main file.
extern CComModule _Module;

Then include the remaining files which helps for an ATL Application. In the insert Object of ATL uses ATLHost.h which needs to compile atlcom.h as before.
#include <atlwin.h>
#include <atlcom.h>

In the StdAfx.cpp, Include AtlImpl.cpp file.
In the main Application file, add the following
//originally declaring the CComModule variable
CComModule _Module;

Then, Add the following two lines, which are required to activate ATL Object Wizard, when you choose Insert ATLObject from Insert Menu.
BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()

Initialize the CComModule variable with ObjectMap and with the current instance in the WinMain function
_Module.Init(ObjectMap, hInstance);

Add the <ProjectName>.idl file into the project and add the library related code:
library TestLIB
&leftsign;
&rightsign;

If you want to insert a dialog and want to show. Follow the above steps and declare the variable of ur dialog class and call DoModal with that variable (don\’t forget to include dlg header file).
Additional Notes
This code has been tested with and works fine with the Windows CE environment.
References and Acknowledgments
ATL Internals – Rector, Sells (My thanks to the Authors!)

One of my co-workers is getting "Error Invoking ATL Object Wizard
Component" when trying to Insert New ATL Object.  why?  What do we do to
fix it?
It should work so there must be something easy going wrong. Make sure that
no file in the directory are write-protected, this usually happens if you
use source safe and forgetts to check out the files. If that does not work,
try to restart the developer studio environment….

Did you mess around manually with the include list in the main project CPP
file?  The Wizard can get cranky if the order of your #include-s at the top
of the file isn\’t IDENTICAL to the Object Map.

It turns out that the programmer had moved MSVC++ from one drive to another
with no corresponding registry changes.  Sorry to have bothered you all.

  • COM组件设计与应用 8-18
  • COM 组件设计与应用 1-7
  • 用ATL建立轻量级的COM对象
  • 用ATL和MFC来创建ActiveX控件
  • 标签:, , , ,
    0419 Compiler Error C2275 - 九月 19, 2006 by yippee

    0419 Compiler Error C2275

    Compiler Error C2275
    \’identifier\’ : illegal use of this type as an expression

    The expression used the class member access operator (->) on the specified typedef identifier.

    The following is an example of this error:

    typedef struct S
    &leftsign;
        int mem;
    &rightsign; *S_t;
    void func1( int *parm );
    void func2()
    &leftsign;
        func1( &S_t->mem );   // error: S_t is a typedef
    &rightsign;

    稀里糊涂了,非常简单的代码

     ***************************************************************************/
    typedef struct 
    &leftsign;
     long l;
     int  i;
    &rightsign;TTT;
    void ss()
    &leftsign;
     int i=1;
     Sleep(10);
     TTT t;
     t.i=i;
    &rightsign;

    error C2275: \’TTT\’ : illegal use of this type as an expression
    see declaration of \’TTT\’
    error C2146: syntax error : missing \’;\’ before identifier \’t\’
    error C2065: \’t\’ : undeclared identifier
    error C2224: left of \’.i\’ must have struct/union type

    倒腾半天,想起来了,这是 .C 文件
    晕倒

    人真是不能生病啊,否则晕头转向的

    受不了~~~~~

    typedef struct 
    &leftsign;
     long l;
     int  i;
    &rightsign;TTT;
    void ss()
    &leftsign;
     int i=1;
     TTT t;
     Sleep(10);
     
     t.i=i;
    &rightsign;

    标签:, , , , ,
    0322 fatal error C1852 VC - 八月 2, 2006 by yippee

    0322 fatal error C1852 VC 折叠 代码 REGION

    可怜的慢机器,偏偏碰到这个问题
    每次都要 REBUILD ALL
    重新编译全部~~~~~ 郁闷

    fatal error C1852: “.\\Debug/VideoNet.pch”不是有效的预编译头文件
    错误都是出在:#include "stdafx.h" 这句话,

    scribble1view.cpp(4)   :   fatal   error   C1852:   \’Debug/Scribble1.pch\’   is   not   a   valid   precompiled   header   file
    file   \’.\\Debug\\Scribble1View.sbr\’:   No   such   file   or   directory

    fatal error C1852: \’.\\Debug/VideoNet.pch\’ is not a valid precompiled header file

    Visual C++ Concepts: Building a C/C++ Program  
    Fatal Error C1852  

    Error Message
    \’filename\’ is not a valid precompiled header file

    The file is not a precompiled header.

    To fix by checking the following possible causes
    Invalid file specified with /Yu or #pragma hdrstop.

    The compiler assumes a file extension of .pch if you do not specify otherwise.

    “filename”不是有效的预编译头文件

    文件不是预编译头文件。

    可能的原因

    用 /Yu 或 #pragma hdrstop 指定的文件无效。
    如果不另外指定,编译器假定为 .pch 文件扩展名。

    Fatal Error C1852
    \’filename\’ is not a valid precompiled header file

    The given filename is not a precompiled header file.

    Make sure that all /Yu command-line option and #pragma hdrstop statements specify valid precompiled header files. The compiler assumes the .PCH extension if none is provided.

    This error is caused by giving the filename of a file that is not a precompiled header, such as an .HPP file.

    折叠并隐藏 Visual Basic .NET 文件中的代码节。
    #Region "identifier_string"
    #End Region
    各部分说明
    identifier_string
    必选项。当区域折叠时作为区域标题的字符串。默认情况下区域是折叠的。
    #End Region
    终止 #Region 块。
    备注
    #Region 指令使您可以指定一个代码块,在使用 Visual Studio 代码编辑器的大纲显示功能时可以展开或折叠此块。#Region 语句支持块语义(如 #If…#End If),这意味着开始和结束必须在同一个代码块内。
    示例
    本示例使用 #Region 指令。
    #Region "MathFunctions"
    \’ Insert code for the Math functions here.
    #End Region
    折叠并隐藏 Visual Basic .NET 文件中的代码节。
    #Region "identifier_string"
    #End Region
    各部分说明
    identifier_string
    必选项。当区域折叠时作为区域标题的字符串。默认情况下区域是折叠的。
    #End Region
    终止 #Region 块。
    备注
    #Region 指令使您可以指定一个代码块,在使用 Visual Studio 代码编辑器的大纲显示功能时可以展开或折叠此块。#Region 语句支持块语义(如 #If…#End If),这意味着开始和结束必须在同一个代码块内。
    示例
    本示例使用 #Region 指令。
    #Region "MathFunctions"
    \’ Insert code for the Math functions here.
    #End Region

    不支持 VC~~~~~~~

    标签:, , ,
    0321 error C2061 error C2091 THIS_FILE NEW - 七月 31, 2006 by yippee

    0321 error C2061 error C2091 THIS_FILE NEW

    加入同事的代码,结果:

    o:\\微软\\vs6\\vc98\\include\\new(35) : error C2061: syntax error : identifier \’THIS_FILE\’
    o:\\微软\\vs6\\vc98\\include\\new(35) : error C2091: function returns function
    o:\\微软\\vs6\\vc98\\include\\new(35) : error C2809: \’operator new\’ has no formal parameters
    o:\\微软\\vs6\\vc98\\include\\new(36) : error C2061: syntax error : identifier \’THIS_FILE\’
    o:\\微软\\vs6\\vc98\\include\\new(37) : error C2091: function returns function
    o:\\微软\\vs6\\vc98\\include\\new(37) : error C2556: \’void *(__cdecl *__cdecl operator new(void))(unsigned int,const struct std::nothrow_t &)\’ : overloaded function differs only by return type from \’void *(__cdecl *__cdecl operator new(void))(unsigned in
    t)\’
            o:\\微软\\vs6\\vc98\\include\\new(35) : see declaration of \’new\’
    o:\\微软\\vs6\\vc98\\include\\new(41) : error C2061: syntax error : identifier \’THIS_FILE\’
    o:\\微软\\vs6\\vc98\\include\\new(42) : error C2091: function returns function
    o:\\微软\\vs6\\vc98\\include\\new(42) : error C2556: \’void *(__cdecl *__cdecl operator new(void))(unsigned int,void *)\’ : overloaded function differs only by return type from \’void *(__cdecl *__cdecl operator new(void))(unsigned int)\’
            o:\\微软\\vs6\\vc98\\include\\new(35) : see declaration of \’new\’
    o:\\微软\\vs6\\vc98\\include\\new(42) : error C2809: \’operator new\’ has no formal parameters
    o:\\微软\\vs6\\vc98\\include\\new(42) : error C2065: \’_P\’ : undeclared identifier
    o:\\微软\\vs6\\vc98\\include\\memory(16) : error C2061: syntax error : identifier \’THIS_FILE\’
    o:\\微软\\vs6\\vc98\\include\\memory(17) : error C2091: function returns function
    o:\\微软\\vs6\\vc98\\include\\memory(17) : error C2784: \’void *(__cdecl *__cdecl operator new(void))(unsigned int,class std::allocator<`template-parameter257\’> &)\’ : could not deduce template argument for \’void *(__cdecl *)(unsigned int,class std::alloca
    tor<_Ty> &)\’ from \’void *(__cdecl *)(unsigned int)\’
    o:\\微软\\vs6\\vc98\\include\\memory(17) : error C2785: \’void *(__cdecl *__cdecl operator new(void))(unsigned int,class std::allocator<`template-parameter257\’> &)\’ and \’void *(__cdecl *__cdecl operator new(void))(unsigned int)\’ have different return type
    s
            o:\\微软\\vs6\\vc98\\include\\memory(16) : see declaration of \’new\’
    o:\\微软\\vs6\\vc98\\include\\memory(17) : error C2809: \’operator new\’ has no formal parameters
    o:\\微软\\vs6\\vc98\\include\\memory(20) : error C2954: template definitions cannot nest
    Generating Code…
    Error executing cl.exe.
    Creating browse info file…

    exe – 17 error(s), 0 warning(s)

    非常恐怖~~~~~~~~

    看看资料:
    宏与头文件错误的冲突问题
    程序如下:
    // SisSocket.cpp : implementation file
    //
    #include "stdafx.h"
    #include "DataServer.h"
    #include "SisSocket.h"
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
    #include "DataServerDlg.h"

    经指点,将
    // SisSocket.cpp : implementation file
    //
    #include "stdafx.h"
    #include "DataServer.h"
    #include "SisSocket.h"
    #include "DataServerDlg.h"
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
    //…其他代码
    问题解决,出在new重定义上
    注:THIS_FILE为static char[],在debug时内容为本文件路径,供输出错误信息使用。

    就是把
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif

    放到所有 INCLUDE 的后面

    标签:, , , ,
    0308 vs.php subversion error msg - 七月 9, 2006 by yippee

    0308 vs.php subversion error msg

    Jcx.Software has announced the availability of VS.Php version 2.0, a PHP editor for Visual Studio 2005.

    ADVERTISEMENT The new version of VS.Php allows developers to build, edit and deploy open-source PHP applications using the familiar interface of the popular Visual Studio IDE. New features in version 2.0 include Jcx.Software\’s integrated Smarty/PHP editor with Intellisense and other rich editing features provided in Visual Studio, company officials said.

    VS.Php provides rich project management features similar to ASP.Net projects, Rivera said. In addition, because many developers deploy their PHP applications in non-Windows servers, VS.Php also provides deployment support for remote servers where users can deploy their PHP applications with a click of a button, he said.

    Error Messages
    This section contains a number of popular errors that people get and possible solutions to avoid or to work around the situation.

    Apache Error Messages
    There are many error messages which can be thrown by apache when you try to access your repository. Most of these errors do not have anything to do with TortoiseSVN, but hint at some server misconfiguration. It is also possible that you have simply entered wrong repository URL.

    To solve the configuration problems, the FAQ isn\’t quite the right place, because we need to know a lot more about your server setup. Please come to our mailing list at dev@tortoisesvn.tigris.org and ask your question there. Also, the Subversion mailing list users@subversion.tigris.org might be an even better idea for server configurations.

    These error messages hint at configuraton problems:

    \’401 Authorization Required\’
    \’500 Internal Server Error\’
    400 Bad Request
    REPORT request failed on \’…\’ REPORT of \’…\’: 400 Bad Request (http://…)

    You\’re behind a firewall which blocks DAV requests. Most firewalls do that.
    Either ask your Administrator to change the firewall, or access the repository with https:// instead of http:// like in https://svn.collab.net/repos/tortoisesvn/
    That way you connect to the repository with SSL encryption, which firewalls can\’t interfere with (if they don\’t block the SSL port completely).

    403 Forbidden
    PROPFIND request failed: 403 Forbidden

    It\’s probably because you\’ve entered the parent path of your repository instead of the actual repository path. Try appending the name of the repository you wish to access to the URL. You also need to append the URL with a trailing \’/\’ slash, after the repository name.

    For more information about the actual error, seek out the Apache error log.

    405 HTTP Method Not Allowed
    PROPFIND Request Failed – Error 405 HTTP Method Not Allowed

    This message comes in different flavours. You might be seeing this error when:

    PROPFIND Request Failed
    You tried to browse the parent path of a repository instead of the repository itself using an older version of TortoiseSVN. Try appending the name of the repository you wish to access, or upgrade TortoiseSVN to 1.2.3 or newer.
    PROPFIND Request Failed
    You forgot to append a \’/\’ slash to the end of the URL you entered. Older versions of TSVN requires that there be a \’/\’ after the repository name. If you forget this, TSVN will strip the repository name from the URL and therefore try to access the parent directory.
    Lock Request Failed
    You tried to lock a file in your working copy which no longer exists in the repository. Update your working copy before trying to lock files.
    For more information about what actually caused the error, seek out the Apache error log.

    501 Not implemented
    The Apache 501 "Not Implemented" error is caused by a regression bug in the subversion 1.2.1 libraries. The "svn st -u" command of subversion 1.2.1 is incompatible with subversion 1.1.x servers. This normally happens when you "check for modifications" against old servers in TortoiseSVN.

    Invalid command \’DAV\’
    Apache doesn\’t start after adding svn:

    Apache throws an Exception that the requested operation failed. When starting the server from console you get an Error:
    Invalid command \’DAV\’ perhaps mis-spelled or defined by a module not included in the server configuration
    Solution: uncomment the line LoadModule dav_module modules/mod_dav.so in httpd too.

    SVN+SSH Error Messages
    File not found
    Go to the Network tab on TortoiseSVN\’s settings dialog. Set the SSH Client to TortoisePlink.exe.

    No repository found in \’svn+ssh://myuser@ 100.101.102.103/ usr/local/repo\’
    Check the path to your repository (here /usr/local/repo) if it really exists on the server and check the permissions on that folder and its contents.

    Unable to write to Standard output

    标签:, , , ,
    0301 CXX0030 Error PC2PC reg  PC2PHONE - 六月 26, 2006 by yippee

    0301 CXX0030 Error PC2PC reg  PC2PHONE

    想调试一个程序,结果出现:
    Unhandled exception in Game.exe 0xc0000005:access Violation

    估计和变量初始化有关

    于是单步调试,不料所有变量都提示这种问题
    CXX0030: Error: expression cannot be evaluated

    看了看,原来设置这里:
    把 INTERMEDIATE FILES输出到
    ..\\..\\..\\binaries\\windows\\debug\\obj

    把OUTPUT FILES输出到
    ..\\..\\..\\binaries\\windows\\debug\\bin

    改为和在一起就可以了

    如果显示这种错误,一般是你的变量已超出了作用域,或者是你输入的表达式是不正确的,你可以把该变量放入QuichWatch检查一下,如果可以检查就成功

    简直快昏头了,以前调试是如果不注册,那么只能PC2PC,不能PC2PHONE,
     sip->InitStack();
     sip->InitCallBack();
     // sip->Register(FROM,TO);
     sip->Call(FROM,TO);
     sip->Events();

    现在好玩了,不管PC2PC 还是 PC2PHONE,都能呼叫出去,并且更绝的是,呼叫出去之后,我这里居然认为对方已经应答了,真是快昏了
    <– Message Received (call-leg b9c490)
    SIP/2.0 200 OK
    From: <sip: www.yippeesoft.com @ www.yippeesoft.com >;tag=b9a6d0-0-13c4-479a-389929bf-479a
    To: <sip:shengfang@ www.yippeesoft.com >;tag=as1796b69a
    Call-ID: b9c490-0-13c4-479a-7d0a595e-479a@192.168.3.190
    CSeq: 1 INVITE
    Via: SIP/2.0/UDP 10.10.30.40:5060;received=10.10.30.40;branch=z9hG4bK-479a-117b2
    d9-4e6f5edc
    User-Agent:  www.yippeesoft.com
    Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
    Contact: <sip:shengfang@ www.yippeesoft.com >
    Content-Type: application/SDP
    Content-Length: 311

    v=0
    o=root 2429 2429 IN IP4 192.168.3.190
    s=session
    c=IN IP4 192.168.3.190
    t=0 0
    m=audio 11386 RTP/AVP 4 8 0 18 101
    a=rtpmap:4 G723/8000
    a=rtpmap:8 PCMA/8000
    a=rtpmap:0 PCMU/8000
    a=rtpmap:18 G729/8000
    a=fmtp:18 annexb=no
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=silenceSupp:off – - – -

    –> Message Sent (call-leg b9c490)
    ACK sip:shengfang@ www.yippeesoft.com  SIP/2.0
    From: <sip: www.yippeesoft.com @ www.yippeesoft.com >;tag=b9a6d0-0-13c4-479a-389929bf-479a
    To: <sip:shengfang@ www.yippeesoft.com >;tag=as1796b69a
    Call-ID: b9c490-0-13c4-479a-7d0a595e-479a@192.168.3.190
    CSeq: 1 ACK
    Via: SIP/2.0/UDP 10.10.30.40:5060;branch=z9hG4bK-479a-117b376-2f5daafe
    Max-Forwards: 70
    Contact: <sip: www.yippeesoft.com @ www.yippeesoft.com >
    Content-Length: 0

    OUTGOING call-leg b9c490 – State changed to Connected

    标签:, , ,