English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. C/C++ (http://eab.abime.net/forumdisplay.php?f=118)
-   -   Amidevcpp c++ link errors (http://eab.abime.net/showthread.php?t=87106)

tolkien 11 May 2017 01:45

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?

Samurai_Crow 11 May 2017 11:45

Looks like libnix is linking before libstdc++. Order is significant.

tolkien 11 May 2017 12:10

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 11 May 2017 21:21

I have tried various combinations and I can only compile it if I remove -noixemul from the link stage.

AmigaEd 21 February 2018 05:37

Quote:

Originally Posted by tolkien (Post 1157357)
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!

emufan 21 February 2018 07:40

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 :/

AmigaEd 01 March 2018 05:10

Quote:

Originally Posted by emufan (Post 1221117)
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. :banghead

themamboman 23 September 2019 15:47

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,

NovaCoder 08 November 2019 02:18

Quote:

Originally Posted by themamboman (Post 1347276)
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


All times are GMT +2. The time now is 18:34.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.

Page generated in 0.04195 seconds with 11 queries