amiga.org
     
iconAll times are GMT -6. The time now is 10:21 PM. | Welcome to Forum, please register to access all of our features.

» Amiga.org » Operating System Specific Discussions » Amiga OS » Amiga OS -- Development » Eclipse, Cross Compiling and Makefile Generation

Amiga OS -- Development This particular forum deals with issues regarding development for all versions of AmigaOS.

Reply
 
Thread Tools Display Modes
Old 01-07-2012, 09:42 PM   #1
EDanaII
Cult Member
Points: 7,148, Level: 55 Points: 7,148, Level: 55 Points: 7,148, Level: 55
Activity: 17% Activity: 17% Activity: 17%
 
EDanaII's Avatar
 
Join Date: Dec 2006
Location: Phoenix, AZ
Posts: 536
Default Eclipse, Cross Compiling and Makefile Generation

So close, so close...

So, I've actually got Eclipse crosscompiling and generating Amiga makefiles. However, at present, I'm getting these errors:
Code:
'Building file: ../Hello.cpp'
'Invoking: Cross G++ Compiler'
m68k-amigaos-g++ -DAMIGA -IP:/Windows/AmiDevCpp/usr/local/amiga/m68k-amigaos/sys-include -IP:\Windows\AmiDevCpp\include\c++\3.4.2\backward -O0 -g3 -Wall -noixemul -MMD -MP -MF"Hello.d" -MT"Hello.d" -o "Hello.o" "../Hello.cpp"
/usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/lib/libstdc++.a(misc-inst.o)(.text+0xfe):misc-inst.o: undefined reference to `_getc'
/usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/lib/libstdc++.a(misc-inst.o)(.text+0x128):misc-inst.o: undefined reference to `_getc'
/usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/lib/libstdc++.a(misc-inst.o)(.text+0x1cc):misc-inst.o: undefined reference to `_putc'
/usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/lib/libstdc++.a(basic_file.o)(.text+0x1c4):basic_file.o: undefined reference to `_fdopen'
collect2: ld returned 1 exit status
make: *** [Hello.o] Error 1
Any ideas?
__________________
Ed.
EDanaII is offline   Reply With Quote
Old 01-08-2012, 03:40 AM   #2
Heinz
Technoid
Points: 6,382, Level: 52 Points: 6,382, Level: 52 Points: 6,382, Level: 52
Activity: 2% Activity: 2% Activity: 2%
 
Heinz's Avatar
 
Join Date: Nov 2005
Posts: 152
Default Re: Eclipse, Cross Compiling and Makefile Generation

Quote:
Originally Posted by EDanaII View Post
So close, so close...

So, I've actually got Eclipse crosscompiling and generating Amiga makefiles. However, at present, I'm getting these errors:
Code:
'Building file: ../Hello.cpp'
'Invoking: Cross G++ Compiler'
m68k-amigaos-g++ -DAMIGA -IP:/Windows/AmiDevCpp/usr/local/amiga/m68k-amigaos/sys-include -IP:\Windows\AmiDevCpp\include\c++\3.4.2\backward -O0 -g3 -Wall -noixemul -MMD -MP -MF"Hello.d" -MT"Hello.d" -o "Hello.o" "../Hello.cpp"
/usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/lib/libstdc++.a(misc-inst.o)(.text+0xfe):misc-inst.o: undefined reference to `_getc'
/usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/lib/libstdc++.a(misc-inst.o)(.text+0x128):misc-inst.o: undefined reference to `_getc'
/usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/lib/libstdc++.a(misc-inst.o)(.text+0x1cc):misc-inst.o: undefined reference to `_putc'
/usr/local/amiga/lib/gcc/m68k-amigaos/3.4.0/../../../../m68k-amigaos/lib/libstdc++.a(basic_file.o)(.text+0x1c4):basic_file.o: undefined reference to `_fdopen'
collect2: ld returned 1 exit status
make: *** [Hello.o] Error 1
Any ideas?
Yes. Look at ld`s output.
It is looking for the libraries at the wrong place.
You need to add something like: -L /path/to/your/libs to the g++ call.
Heinz is offline   Reply With Quote
Old 01-08-2012, 03:48 AM   #3
NovaCoder
Premium Member
Points: 8,227, Level: 61 Points: 8,227, Level: 61 Points: 8,227, Level: 61
Activity: 63% Activity: 63% Activity: 63%
 
NovaCoder's Avatar
 
Join Date: Apr 2008
Location: Oz
Posts: 1,235
Blog Entries: 2
Default Re: Eclipse, Cross Compiling and Makefile Generation

Let me know if you ever get it working well, I've always wanted to use eclipse (on Windows) to generate 68k code.
__________________
Life begins at 100 MIPS!


ScummVM AGA, BOOM AGA, AmiQuake AGA, AmiQuake 2 AGA
NovaCoder is offline   Reply With Quote
Old 01-08-2012, 09:37 AM   #4
EDanaII
Cult Member
Points: 7,148, Level: 55 Points: 7,148, Level: 55 Points: 7,148, Level: 55
Activity: 17% Activity: 17% Activity: 17%
 
EDanaII's Avatar
 
Join Date: Dec 2006
Location: Phoenix, AZ
Posts: 536
Default Re: Eclipse, Cross Compiling and Makefile Generation

Well, I succeeded in figuring out how to get Eclipse to create an Amiga project including automatic generation of Makefiles. And it wasn't as difficult as I thought, I just needed the time to figure it out.

Prerequisites:
1. Eclipse and the CDT/, obviously.
2a. ZeroHero's Cross Compiler tools.
2b. Alternatively AmiDevCpp. I used this as I already had AmiDevCpp set up on my computer.

Steps are as follows:
  1. In Eclipse, select New -> Cpp Project
  2. Enter a Project Name.
  3. Under Executable, select Cross Compile project.
  4. Click Next
  5. In Tool Command Prefix, enter "m68k-amigaos-" without quotes. You can change this to change your target compilation. For example, if you want to compile to AROS on x86, change it to "i386-aros-". For MorphOS, it can be changed to "ppc-morphos-" and AmigaOS 4.0 is "ppc-amigaos-".
  6. In Tool Command Path enter: {Root path to Cross Compiler}usr\local\amiga\bin, for me this was: P:\Windows\AmiDevCpp\usr\local\amiga\bin the location of ZeroHero's cross compiler within AmiDevCpp.
  7. Click Finish.

You are now free to add a Source file to your project. I used this one:
Code:
#include <iostream>

using namespace std;

int main (int argc, char *argv[])
{
  cout << "Hello Nerd!" << endl;
  cin.get();

  return 0;
}
If you try this, some things to be aware of: Initially, when I tried this, the source code, above, showed errors like not being able to find iostream and/or cout or cin. I tweaked this by for example, turning discovery options on, which caused the problem with my first post in this thread, and then back off, which seemed to allow everything to work perfectly.

So, if you try this and encounter anything different, please report back here so I can continue to refine this.

Up next: try some (slightly) more complex objects.
__________________
Ed.
EDanaII is offline   Reply With Quote
Old 01-08-2012, 11:00 AM   #5
EDanaII
Cult Member
Points: 7,148, Level: 55 Points: 7,148, Level: 55 Points: 7,148, Level: 55
Activity: 17% Activity: 17% Activity: 17%
 
EDanaII's Avatar
 
Join Date: Dec 2006
Location: Phoenix, AZ
Posts: 536
Default Re: Eclipse, Cross Compiling and Makefile Generation

This is turning out to be surprisingly painless. By following the above steps but pointing to an existing project (with C++ classes in it) and omitting the Hello.cpp file, Eclipse discovered everything and made the project with only minor issues. Everything compiled and works, the only issues were code detection. One file, for example, claimed that the header declarations for some methods (involving the string object in the <string> header) were missing, despite everything compiling just fine. Deleting the project and then re-creating it cleared this problem and everything seems to work flawlessly... so far.

Kudos to Eclipse for making it this smart.
__________________
Ed.
EDanaII is offline   Reply With Quote
Old 01-08-2012, 03:09 PM   #6
NovaCoder
Premium Member
Points: 8,227, Level: 61 Points: 8,227, Level: 61 Points: 8,227, Level: 61
Activity: 63% Activity: 63% Activity: 63%
 
NovaCoder's Avatar
 
Join Date: Apr 2008
Location: Oz
Posts: 1,235
Blog Entries: 2
Default Re: Eclipse, Cross Compiling and Makefile Generation

Thanks, I'll follow your little guide and see how I get on
__________________
Life begins at 100 MIPS!


ScummVM AGA, BOOM AGA, AmiQuake AGA, AmiQuake 2 AGA
NovaCoder is offline   Reply With Quote
Reply

Bookmarks

Tags
compiling , cross , eclipse , generation , makefile

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump