English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 11 May 2017, 00:45   #1
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
Amidevcpp c++ link errors

Hello mates!

I´m trying to compile the simplest C++ project wit amidevcpp for classic Amiga with no success.
I can do it for the rest of the targets but no for 68k and is a clean install.

I get the follwing errors:

Code:
Compilador: m68k-Amiga-OS3
Building Makefile: "C:\Users\Johan\Makefile.win"
Ejecutando  make clean
rm -f MorphOS_hello.o Proyecto1.exe

m68k-amigaos-g++.exe -c MorphOS_hello.cpp -o MorphOS_hello.o -I"C:/CrossCompiler/AmiDevCpp/usr/local/amiga/m68k-amigaos/sys-include"    -s -noixemul

m68k-amigaos-g++.exe MorphOS_hello.o -o "Proyecto1.exe" -L"C:/CrossCompiler/AmiDevCpp/usr/local/amiga/m68k-amigaos/lib" -L"C:/CrossCompiler/AmiDevCpp/usr/local/amiga/m68k-amigaos/lib/libb/libnix" -s -noixemul  

C:/CrossCompiler/AmiDevCpp/usr/local/amiga/m68k-amigaos/lib/libstdc++.a(misc-inst.o)(.text+0xfe):misc-inst.o: undefined reference to `_getc'
C:/CrossCompiler/AmiDevCpp/usr/local/amiga/m68k-amigaos/lib/libstdc++.a(misc-inst.o)(.text+0x128):misc-inst.o: undefined reference to `_getc'
C:/CrossCompiler/AmiDevCpp/usr/local/amiga/m68k-amigaos/lib/libstdc++.a(misc-inst.o)(.text+0x1cc):misc-inst.o: undefined reference to `_putc'
C:/CrossCompiler/AmiDevCpp/usr/local/amiga/m68k-amigaos/lib/libstdc++.a(basic_file.o)(.text+0x1c4):basic_file.o: undefined reference to `_fdopen'
collect2: ld returned 1 exit status
mingw32-make.exe: *** [Proyecto1.exe] Error 1

The example is:

Code:
#include <iostream>

using namespace std;

int main (int argc, char *argv[])
{
  cout << "Hello Amiga World!" << endl;
  cout << "Press ENTER to continue..." << endl;
  cin.get();
  return 0;
}
Dont know what can be wrong. Any idea?

Last edited by tolkien; 11 May 2017 at 00:48. Reason: Typo
tolkien is offline  
Old 11 May 2017, 10:45   #2
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
Looks like libnix is linking before libstdc++. Order is significant.
Samurai_Crow is offline  
Old 11 May 2017, 11:10   #3
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
It can be but it should be done right by the IDE. Will look for to how to change that per default.
Thanks samurai_crow!
tolkien is offline  
Old 11 May 2017, 20:21   #4
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
I have tried various combinations and I can only compile it if I remove -noixemul from the link stage.
tolkien is offline  
Old 21 February 2018, 04:37   #5
AmigaEd
Zone Friend
 
Join Date: Feb 2005
Location: USA
Posts: 35
Quote:
Originally Posted by tolkien View Post
I have tried various combinations and I can only compile it if I remove -noixemul from the link stage.
I am experiencing the same results as tolkien reports. I too have tried many configuration combinations but can only get it to compile if I remove the -noixeml from the linker configuration.

I believe that this is not really a solution and will eventually result in problems further down the road.

Is there someone who is successfully using AmiDevCpp who can describe how they got around this problem and / or what their working configuration is?

Thanks in Advance!
AmigaEd is offline  
Old 21 February 2018, 06:40   #6
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
dunno exactly, but the three functions are simply missing in libnix(!?).

they do exists in the gcc6 toolchain by bebbo.
so here you can build it with: m68k-amigaos-g++.exe -noixemul hello.cpp
Code:
$ m68k-amigaos-g++.exe -noixemul -Wl,--verbose hello.cpp
...
(/opt/m68k-amigaos/m68k-amigaos/libnix/lib/libnix/libnix.a)putc.o
(/opt/m68k-amigaos/m68k-amigaos/libnix/lib/libnix/libnix.a)fdopen.o
(/opt/m68k-amigaos/m68k-amigaos/libnix/lib/libnix/libnix.a)getc.o

...
so build it with ixemul.library support, without the "-noixemul" option.
most the things I build were done using ixemul.library and those did work.

#1) you can use -Wl,--verbose linker option, this will not help here,
but it lists all the libraries the linker is searching for functions.
AmiDevCPP lists the output in the "Compiler Log" tab.

#2) I was wrong with my assumption, other linker options, replacing "-noixemul",
would build different binary, without using ixemul.library. but this was wrong and removed here :/

Last edited by emufan; 21 February 2018 at 07:07.
emufan is offline  
Old 01 March 2018, 04:10   #7
AmigaEd
Zone Friend
 
Join Date: Feb 2005
Location: USA
Posts: 35
Quote:
Originally Posted by emufan View Post
dunno exactly, but the three functions are simply missing in libnix(!?).

they do exists in the gcc6 toolchain by bebbo.
so here you can build it with: m68k-amigaos-g++.exe -noixemul hello.cpp
:/
I haven't had free time to dig into this further but will look at bebbo's toolchain.

From my perspective it is a bit of a shame that AmiDevCpp isn't really configured to just link and compile out of the box. It would probably be a bit more attractive to newbie users trying to get started with writing programs for AROS, 3.9, etc.

In my case, there is no excuse really. I did have AmiDevCpp up and working fairly well once upon a time but I dropped out of the Ami scene for too long and am now trying to find my way again. If only I could find my notebooks that got packed away during the last move.
AmigaEd is offline  
Old 23 September 2019, 14:47   #8
themamboman
Registered User
 
Join Date: Dec 2012
Location: Atlanta, USA
Posts: 154
Was the only solution to compiling C++ with AmiDevCPP to upgrade to gcc6 as mentioned earlier? I find AmiDevCPP to be fine with C programs, but I would like to port some C++ programs and I really like AmiDevCPP.

Thanks,
themamboman is offline  
Old 08 November 2019, 01:18   #9
NovaCoder
Registered User
 
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
Quote:
Originally Posted by themamboman View Post
Was the only solution to compiling C++ with AmiDevCPP to upgrade to gcc6 as mentioned earlier? I find AmiDevCPP to be fine with C programs, but I would like to port some C++ programs and I really like AmiDevCPP.


Thanks,
You don't need to upgrade AmiDevCPP to compile C++, I've compiled numerous C++ projects using it for Amiga 68k
NovaCoder is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
AmiDevCpp asm - undefined reference Sephnroth Coders. C/C++ 14 27 December 2022 16:51
AmiDevCpp $(GLOBALDEPS) mritter0 Coders. C/C++ 1 29 June 2015 01:30
AmiDevCpp AF2013 Coders. C/C++ 0 14 March 2014 00:23
Problem compiling with AmiDevCpp Franchute13 Coders. C/C++ 2 26 September 2013 15:01
AmiDevCpp and Floats AmigaEd Coders. General 0 18 January 2006 03:16

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


All times are GMT +2. The time now is 15:30.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07744 seconds with 13 queries