On Aug 30, 12:48 pm, [EMAIL PROTECTED] wrote: > Hello All > > I'm new to the forum, and I have a problem I hope you guys can help me > with. I have pasted some code below which I am trying to compile using > sde-lite on my linux box, and I am having one hell of a time trying to > do so. Can someone please take a look and the code and the compile > messages I get and tell me whats wrong, I've been at this for weeks > now, help me please! > > Messages from the compile shown below. Its seems to be indicating that > there some incorrect paths to directories that I am missing. > The actual directories its mentions below are located in /sde-5.03/ > sde6/include/c++/3.4.4. How can I correct this problem? > > #include<ciso646> > #include<cmath> > #include<iomanip> > #include<iostream> > > unsigned int GCD_FUNCT( unsigned int, unsigned int ); > > int main() { > > unsigned int ARRAY[32], GCD[16]; > unsigned int Loop_Control_V, Reg1, Reg2, new_value; > > for ( unsigned int i = 0; i < 31; ++ i ) { > > new_value = i + ( 3 * (4) ); > > if ( new_value % 2 != 0 ) { > > new_value = new_value * 4; > > } > > else{ > new_value = new_value * 10; > > } > > ARRAY[i] = new_value; > > } > > Loop_Control_V = 0; > > while ( Loop_Control_V < 30 ) { > > if ( ARRAY[Loop_Control_V] > ARRAY[Loop_Control_V + 1] ) { > > Reg1 = ARRAY[Loop_Control_V]; > Reg2 = ARRAY[Loop_Control_V + 1]; > > } > > else { > Reg1 = ARRAY[Loop_Control_V + 1]; > Reg2 = ARRAY[Loop_Control_V]; > > } > > GCD[Loop_Control_V] = GCD_FUNCT(Reg1,Reg2); > Loop_Control_V = Loop_Control_V + 1; > > } > > return 0; > > } > > unsigned int GCD_FUNCT( unsigned int REGa, unsigned int REGb) { > > unsigned int temp1, temp2, GCD; > > temp1 = REGa; > temp2 = REGb; > > while ( temp1 != temp2 ) { > > if ( temp1 > temp2 ) { > > temp1 = temp1 - temp2;} > > else { > temp2 = temp2 - temp1;} > } > > GCD = temp1; > return GCD; > > } > > sde-cpp -v -mtune=r2k -T ph.ld -O2 GCD.cpp -o GCD.bin > > Messages from the compile shown below. Its seems to be indicating that > there some incorrect paths to directories that I am missing the > directories it mentions below are located in /sde-5.03/sde6/include/c+ > +/3.4.4. How can I correct this problem? > > Reading specs from /accts/ddwashin/Engineering_Projects/sde-5.03/ > bin/../lib/gcc/sde/3.4.4/specs > Configured with: /var/tmp/releasetool.tmp/bank-20070420-1231/B-i386- > linux/toolchain/mipssde-6.06.01/configure --target=sde --prefix=/usr/ > local/sde6 --enable-languages=c,c++ --without-newlib --disable-shared > --disable-nls --disable-tui --disable-multilib > Thread model: mipssde > gcc version 3.4.4 mipssde-6.06.01-20070420 > /accts/ddwashin/Engineering_Projects/sde-5.03/bin/../libexec/gcc/sde/ > 3.4.4/cc1plus -E -quiet -v -iprefix /accts/ddwashin/ > Engineering_Projects/sde-5.03/bin/../lib/gcc/sde/3.4.4/ GCD.cpp -o > GCD.bin -mtune=r2k -O2 > ignoring nonexistent directory "/usr/local/sde6/include/c++/3.4.4" > ignoring nonexistent directory "/usr/local/sde6/include/c++/3.4.4/sde" > ignoring nonexistent directory "/usr/local/sde6/include/c++/3.4.4/ > backward" > ignoring nonexistent directory "/usr/local/sde6/lib/gcc/sde/3.4.4/ > include" > ignoring nonexistent directory "/var/tmp/releasetool.tmp/ > bank-20070420-1231/B-i386-linux/toolchain-build/sde/include" > ignoring nonexistent directory "/usr/local/sde6/sde/include" > #include "..." search starts here: > #include <...> search starts here: > /accts/ddwashin/Engineering_Projects/sde-5.03/bin/../lib/gcc/sde/ > 3.4.4/../../../../include/c++/3.4.4 > /accts/ddwashin/Engineering_Projects/sde-5.03/bin/../lib/gcc/sde/ > 3.4.4/../../../../include/c++/3.4.4/sde > /accts/ddwashin/Engineering_Projects/sde-5.03/bin/../lib/gcc/sde/ > 3.4.4/../../../../include/c++/3.4.4/backward > /accts/ddwashin/Engineering_Projects/sde-5.03/bin/../lib/gcc/sde/ > 3.4.4/ > include > /accts/ddwashin/Engineering_Projects/sde-5.03/bin/../lib/gcc/sde/ > 3.4.4/../../../../sde/include > End of search list. > GCD.cpp:76:3: warning: no newline at end of file
I am using the following command sde-g++ -v -mtune=r2k -T ph.ld -O2 GCD.cpp -o GCD.bin, and I am having no success but if I remove iostream the compile will run fine, the problem is that I do not believe its creating the right mips-elf file when I look at the assembler code from the disassembler list the code doesn't appear to work right, following the code line by line I see mistakes that will eventually lead to infinite loops and the c++ code I wrote is fine it compiles in DEV C++ and runs fine but the code produced by g++ that I am testing on my processor more than likly will not work because I don't believe it was done correctly by the linker and compiler and I believe its because I have to remove iostream. What do you guys think? The Disassemebleed code is shown below, with the compile commands I used to get the result. sde-g++ -mtune=r2k -T ph.ld -O2 GCD.cpp -o GCD.bin sde-objdump --disassemble --line-numbers --source GCD.bin > disassemble.list GCD.bin: file format elf32-tradbigmips Disassembly of section .text: 00000000 <__do_global_dtors_aux>: __do_global_dtors_aux(): 0: 27bdffe0 addiu sp,sp,-32 4: afb10014 sw s1,20(sp) 8: 3c110001 lui s1,0x1 c: 92220020 lbu v0,32(s1) 10: afbf0018 sw ra,24(sp) 14: 14400012 bnez v0,60 <__do_global_dtors_aux+0x60> 18: afb00010 sw s0,16(sp) 1c: 10000004 b 30 <__do_global_dtors_aux+0x30> 20: 3c100001 lui s0,0x1 24: 24c50004 addiu a1,a2,4 28: 0060f809 jalr v1 2c: ae050008 sw a1,8(s0) 30: 8e040008 lw a0,8(s0) 34: 8c830000 lw v1,0(a0) 38: 1460fffa bnez v1,24 <__do_global_dtors_aux+0x24> 3c: 8e060008 lw a2,8(s0) 40: 3c070000 lui a3,0x0 44: 24e30000 addiu v1,a3,0 48: 10600003 beqz v1,58 <__do_global_dtors_aux+0x58> 4c: 3c080001 lui t0,0x1 50: 0c000000 jal 0 <__do_global_dtors_aux> 54: 25040000 addiu a0,t0,0 58: 24090001 li t1,1 5c: a2290020 sb t1,32(s1) 60: 8fbf0018 lw ra,24(sp) 64: 8fb10014 lw s1,20(sp) 68: 8fb00010 lw s0,16(sp) 6c: 03e00008 jr ra 70: 27bd0020 addiu sp,sp,32 00000074 <frame_dummy>: frame_dummy(): 74: 3c030000 lui v1,0x0 78: 27bdffe8 addiu sp,sp,-24 7c: 3c040001 lui a0,0x1 80: 3c050001 lui a1,0x1 84: 24620000 addiu v0,v1,0 88: afbf0010 sw ra,16(sp) 8c: 24840000 addiu a0,a0,0 90: 10400003 beqz v0,a0 <frame_dummy+0x2c> 94: 24a50024 addiu a1,a1,36 98: 0c000000 jal 0 <__do_global_dtors_aux> 9c: 00000000 nop a0: 3c040001 lui a0,0x1 a4: 8c86001c lw a2,28(a0) a8: 10c00008 beqz a2,cc <frame_dummy+0x58> ac: 8fbf0010 lw ra,16(sp) b0: 3c080000 lui t0,0x0 b4: 25070000 addiu a3,t0,0 b8: 10e00004 beqz a3,cc <frame_dummy+0x58> bc: 2484001c addiu a0,a0,28 c0: 8fbf0010 lw ra,16(sp) c4: 08000000 j 0 <__do_global_dtors_aux> c8: 27bd0018 addiu sp,sp,24 cc: 03e00008 jr ra d0: 27bd0018 addiu sp,sp,24 000000d4 <_Z9GCD_FUNCTjj>: _Z9GCD_FUNCTjj(): d4: 10850007 beq a0,a1,f4 <_Z9GCD_FUNCTjj+0x20> d8: 00000000 nop dc: 00a4102b sltu v0,a1,a0 e0: 10400006 beqz v0,fc <_Z9GCD_FUNCTjj+0x28> e4: 00000000 nop e8: 00852023 subu a0,a0,a1 ec: 1485fffb bne a0,a1,dc <_Z9GCD_FUNCTjj+0x8> f0: 00000000 nop f4: 03e00008 jr ra f8: 00801021 move v0,a0 fc: 1000fff5 b d4 <_Z9GCD_FUNCTjj> 100: 00a42823 subu a1,a1,a0 00000104 <main>: main(): 104: 27bdff20 addiu sp,sp,-224 108: 27a80010 addiu t0,sp,16 10c: afbf00d8 sw ra,216(sp) 110: afb100d4 sw s1,212(sp) 114: afb000d0 sw s0,208(sp) 118: 00002821 move a1,zero 11c: 01003021 move a2,t0 120: 24a2000c addiu v0,a1,12 124: 00021880 sll v1,v0,0x2 128: 24a50001 addiu a1,a1,1 12c: 30440001 andi a0,v0,0x1 130: 00621821 addu v1,v1,v0 134: 2ca7001f sltiu a3,a1,31 138: 14800002 bnez a0,144 <main+0x40> 13c: 00021080 sll v0,v0,0x2 140: 00031040 sll v0,v1,0x1 144: acc20000 sw v0,0(a2) 148: 14e0fff5 bnez a3,120 <main+0x1c> 14c: 24c60004 addiu a2,a2,4 150: 01008021 move s0,t0 154: 2411001d li s1,29 158: 8e060000 lw a2,0(s0) 15c: 8e030004 lw v1,4(s0) 160: 2631ffff addiu s1,s1,-1 164: 0066382b sltu a3,v1,a2 168: 00c02021 move a0,a2 16c: 14e00003 bnez a3,17c <main+0x78> 170: 00602821 move a1,v1 174: 00602021 move a0,v1 178: 00c02821 move a1,a2 17c: 0c000035 jal d4 <_Z9GCD_FUNCTjj> 180: 00000000 nop 184: ae020080 sw v0,128(s0) 188: 0621fff3 bgez s1,158 <main+0x54> 18c: 26100004 addiu s0,s0,4 190: 8fbf00d8 lw ra,216(sp) 194: 8fb100d4 lw s1,212(sp) 198: 8fb000d0 lw s0,208(sp) 19c: 00001021 move v0,zero 1a0: 03e00008 jr ra 1a4: 27bd00e0 addiu sp,sp,224 000001a8 <__do_global_ctors_aux>: __do_global_ctors_aux(): 1a8: 27bdffe0 addiu sp,sp,-32 1ac: 3c040001 lui a0,0x1 1b0: afb00010 sw s0,16(sp) 1b4: 24820010 addiu v0,a0,16 1b8: afbf0018 sw ra,24(sp) 1bc: afb10014 sw s1,20(sp) 1c0: 8c44fffc lw a0,-4(v0) 1c4: 2403ffff li v1,-1 1c8: 10830008 beq a0,v1,1ec <__do_global_ctors_aux+0x44> 1cc: 2450fffc addiu s0,v0,-4 1d0: 00801021 move v0,a0 1d4: 2411ffff li s1,-1 1d8: 0040f809 jalr v0 1dc: 2610fffc addiu s0,s0,-4 1e0: 8e020000 lw v0,0(s0) 1e4: 1451fffc bne v0,s1,1d8 <__do_global_ctors_aux+0x30> 1e8: 00000000 nop 1ec: 8fbf0018 lw ra,24(sp) 1f0: 8fb10014 lw s1,20(sp) 1f4: 8fb00010 lw s0,16(sp) 1f8: 03e00008 jr ra 1fc: 27bd0020 addiu sp,sp,32 Disassembly of section .init: 00000200 <_init>: _init(): 200: 27bdffe0 addiu sp,sp,-32 204: afbf0014 sw ra,20(sp) 208: 0c00001d jal 74 <frame_dummy> 20c: 00000000 nop 210: 0c00006a jal 1a8 <__do_global_ctors_aux> 214: 00000000 nop 218: 8fbf0014 lw ra,20(sp) 21c: 03e00008 jr ra 220: 27bd0020 addiu sp,sp,32 Disassembly of section .fini: 00000224 <_fini>: _fini(): 224: 27bdffe0 addiu sp,sp,-32 228: afbf0014 sw ra,20(sp) 22c: 0c000000 jal 0 <__do_global_dtors_aux> 230: 00000000 nop 234: 8fbf0014 lw ra,20(sp) 238: 03e00008 jr ra 23c: 27bd0020 addiu sp,sp,32 _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus