English Amiga Board


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

 
 
Thread Tools
Old Yesterday, 19:58   #1081
bebbo
compiler compiler

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 348
Code:
In file included from /usr/include/x86_64-linux-gnu/sys/select.h:47:0,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:219,
                 from /usr/include/stdlib.h:275,
                 from /usr/include/c++/6/cstdlib:75,
                 from /usr/include/c++/6/stdlib.h:36,
                 from Array.h:4,
                 from AmigaFile.h:6,
                 from AmigaFile.cpp:3:
/usr/include/x86_64-linux-gnu/bits/time.h:30:8: error: redefinition of ‘struct timeval’
 struct timeval
        ^~~~~~~
In file included from /opt/amiga/m68k-amigaos/ndk-include/dos/dosextens.h:26:0,
                 from /opt/amiga/m68k-amigaos/ndk-include/clib/dos_protos.h:21,
                 from AmigaFile.cpp:1:
/opt/amiga/m68k-amigaos/ndk-include/devices/timer.h:30:8: error: previous definition of ‘struct timeval’
 struct timeval {
Is there some obvious error in the makefile?[/QUOTE]

/usr/include/x86_64-linux-gnu/

that's funny and not a good include path to compile for the Amiga...
bebbo is offline  
Old Today, 00:00   #1082
hmn
Registered User

 
Join Date: Nov 2016
Location: DE
Posts: 15
Make infers automatically that is has to compile the objects with a C++ compiler - but you only tell it what C compiler to use (variable CC), and thus it uses the system default (c++) for your cpp files.

So you need to define and use CXX instead of CC.
hmn is offline  
Old Today, 00:16   #1083
Hedeon
Sonnet Hacker

 
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 913
You have to #ifndef either the NDK timer.h's timeval or the time.h timeval. Otherwise they clash. At least, it was that way in my includes.
Hedeon is offline  
Old Today, 11:03   #1084
bebbo
compiler compiler

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 348
Quote:
Originally Posted by Hedeon View Post
You have to #ifndef either the NDK timer.h's timeval or the time.h timeval. Otherwise they clash. At least, it was that way in my includes.
there is no need for #ifdef fiddling with timeval in amiga-gcc.
bebbo is offline  
Old Today, 11:51   #1085
thyslo
Registered User
 
Join Date: Apr 2018
Location: Dresden / Germany
Posts: 28
Quote:
Originally Posted by hmn View Post
Make infers automatically that is has to compile the objects with a C++ compiler - but you only tell it what C compiler to use (variable CC), and thus it uses the system default (c++) for your cpp files.

So you need to define and use CXX instead of CC.
Thank you, that solved it!

So this little makefile ist compiling my test app without problems:

Code:
CXX=/opt/amiga/bin/m68k-amigaos-c++
CXXFLAGS=-Wall -Wno-unused-function -noixemul -Os

APPNAME = Test

$(APPNAME): AmigaFile.o SimpleString.o main.o
  $(CXX) $(CXXFLAGS) -o $(APPNAME) AmigaFile.o SimpleString.o main.o

clean:
  rm -f *.o $(APPNAME)
thyslo is offline  
Old Today, 17:29   #1086
Hedeon
Sonnet Hacker

 
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 913
Quote:
Originally Posted by bebbo View Post
there is no need for #ifdef fiddling with timeval in amiga-gcc.
Why not?

Edit:

Oh yeah.. It is already #if fiddled out in newlib ic....

#if 0
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* and microseconds */
};
#endif
#include <devices/timer.h>

Last edited by Hedeon; Today at 17:43.
Hedeon is offline  
Old Today, 19:28   #1087
bebbo
compiler compiler

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 348
Quote:
Originally Posted by Hedeon View Post
Why not?

Edit:

Oh yeah.. It is already #if fiddled out in newlib ic....

#if 0
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* and microseconds */
};
#endif
#include <devices/timer.h>
random hacking prevails
bebbo is offline  
Old Today, 19:36   #1088
bebbo
compiler compiler

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 348
Quote:
Originally Posted by thyslo View Post
Thank you, that solved it!

So this little makefile ist compiling my test app without problems:

Code:
CXX=/opt/amiga/bin/m68k-amigaos-c++
CXXFLAGS=-Wall -Wno-unused-function -noixemul -Os

APPNAME = Test

$(APPNAME): AmigaFile.o SimpleString.o main.o
  $(CXX) $(CXXFLAGS) -o $(APPNAME) AmigaFile.o SimpleString.o main.o

clean:
  rm -f *.o $(APPNAME)
if you don't use features like exceptions or rtti I strongly encourage using -fno-rtti -fno-exceptions
bebbo is offline  
Old Today, 19:50   #1089
thyslo
Registered User
 
Join Date: Apr 2018
Location: Dresden / Germany
Posts: 28
Quote:
Originally Posted by bebbo View Post
if you don't use features like exceptions or rtti I strongly encourage using -fno-rtti -fno-exceptions
For a smaller code size of the executables? I'll try it, thank you!
thyslo is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
New GCC based dev toolchain for AmigaOS 3.x cla Coders. Releases 8 24 December 2017 11:18
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 23:33
New 68k gcc toolchain arti Coders. C/C++ 17 31 July 2015 04:59
Hannibal's WinUAE Demo Toolchain 5 Bobic Amiga scene 1 23 July 2015 22:04
From gcc to vbcc. Cowcat Coders. General 9 06 June 2014 15:45

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 23:45.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.10840 seconds with 15 queries