Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
48 user(s) are online (40 user(s) are browsing Forums)

Members: 0
Guests: 48

more...
Support us!
Recent OS4 Files
OS4Depot.net



(1) 2 3 4 ... 8 »


Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a story that hasn't been written yet
Posts: 3528
Since nobody done it and i really need (want) a central meeting point of all questions porting i start a thread here (yes, i know about OS4Porting and the IRC and some other sites, but i'm not going to register to any more sites, so...)

First question:

I'm trying to port (from scratch) a program (available for linux, windows, mac and android, so i guess pretty portable already) but am stuck with a compiler error which "seems" to be really easy to fix, but alas it's not.

This is the snippet from the file in question (src/dctypes.h, lines 31-40)
...
#include <string>
#include <list>
#include <vector>

using namespace std;


typedef std::string AnsiString;
typedef std::string Utf8String;
typedef std::wstring WideString;
...


and this is the error the compiler is throwing...obviously the mentioned "fix" doesn't comply as #include <string> is already in place
mkdir -p obj
g
++ --o obj/AdActor.../src/AdActor.cpp -I../src -O2 -Wno-write-strings -Wno-conversion-null `freetype-config --cflags` `sdl2-config --cflags` -I/usr/local/include/bass
In file included from ../src/PlatformSDL.h:31,
                 
from ../src/dcgf.h:61,
                 
from ../src/AdActor.cpp:26:
../
src/dctypes.h:40:14error'wstring' in namespace 'std' does not name a type
 typedef std
::wstring WideString;
              ^~~~~~~
../
src/dctypes.h:40:9note'std::wstring' is defined in header '<string>'did you forget to '#include <string>'?
../
src/dctypes.h:32:1:
+
#include <string>
 #include <string>
../src/dctypes.h:40:9:
 
typedef std::wstring WideString;
         ^~~
../
src/dctypes.h:43:19error'WideString' was not declared in this scope
 typedef std
::list<WideStringWideStringList;
                   ^~~~~~~~~~
../
src/dctypes.h:43:19notesuggested alternative'Utf8String'
 
typedef std::list<WideStringWideStringList;
                   ^~~~~~~~~~
                   
Utf8String
../src/dctypes.h:43:29errortemplate argument 1 is invalid
 typedef std
::list<WideStringWideStringList;
                             ^
../
src/dctypes.h:43:29errortemplate argument 2 is invalid
../src/dctypes.h:46:21error'WideString' was not declared in this scope
 typedef std
::vector<WideStringWideStringArray;
                     ^~~~~~~~~~
../
src/dctypes.h:46:21notesuggested alternative'WideStringList'
 
typedef std::vector<WideStringWideStringArray;
                     ^~~~~~~~~~
                     
WideStringList
../src/dctypes.h:46:31errortemplate argument 1 is invalid
 typedef std
::vector<WideStringWideStringArray;
                               ^
../
src/dctypes.h:46:31errortemplate argument 2 is invalid
In file included from 
../src/dcgf.h:171,
                 
from ../src/AdActor.cpp:26:
../
src/BFontTT.h:43:3error'WideString' does not name a typedid you mean 'FT_String'?
   
WideString m_Text;
   ^~~~~~~~~~
   
FT_String
../src/BFontTT.h:98:18error'WideString' does not name a typedid you mean 'FT_String'?
   
TextLine(const WideStringtextint width)
                  ^~~~~~~~~~
                  
FT_String
../src/BFontTT.h:104:9error'WideString' does not name a typedid you mean 'FT_String'?
   const 
WideStringGetText() const { return m_Text; }
         ^~~~~~~~~~
         
FT_String
../src/BFontTT.h:107:3error'WideString' does not name a typedid you mean 'FT_String'?
   
WideString m_Text;
   ^~~~~~~~~~
   
FT_String
../src/BFontTT.h:139:21error'WideString' does not name a typedid you mean 'FT_String'?
  
int WrapText(const WideStringtextint maxWidthint maxHeightTextLineListlines);
                     ^~~~~~~~~~
                     
FT_String
../src/BFontTT.h:140:25error'WideString' does not name a typedid you mean 'FT_String'?
  
void MeasureText(const WideStringtextint maxWidthint maxHeightinttextWidthinttextHeight);
                         ^~~~~~~~~~
                         
FT_String
../src/BFontTT.h:142:27error'WideString' does not name a typedid you mean 'FT_String'?
  
void PrepareGlyphs(const WideStringtext);
                           ^~~~~~~~~~
                           
FT_String
../src/BFontTT.h:145:39error'WideString' does not name a typedid you mean 'FT_String'?
  
CBSurfaceRenderTextToTexture(const WideStringtextint widthTTextAlign alignint maxHeightinttextOffset);
                                       ^~~~~~~~~~
                                       
FT_String
../src/BFontTT.hIn constructor 'CBFontTT::CBCachedTTFontText::CBCachedTTFontText()':
../
src/BFontTT.h:55:4error'm_Text' was not declared in this scope
    m_Text 
L"";
    ^~~~~~
../
src/BFontTT.h:55:4notesuggested alternative'm_Rect'
    
m_Text L"";
    ^~~~~~
    
m_Rect
../src/BFontTT.hIn constructor 'CBFontTT::TextLine::TextLine(const int&, int)':
../
src/BFontTT.h:100:4error'm_Text' was not declared in this scope
    m_Text 
text;
    ^~~~~~
../
src/BFontTT.h:100:4notesuggested alternative'm_Rect'
    
m_Text text;
    ^~~~~~
    
m_Rect
gmake
: *** [obj/AdActor.oError 1


Is this one of those c++11 (or higher) errors (which are not or only partly supported yet) or do i need to adapt the source in one way or another?

Using gcc 8.1.0 here

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr.
   Report Go to top

Re: Porting to AmigaOS4 thread
Just popping in
Joined:
12/16 8:42
From Czech Republic
Posts: 53
@Raziel

I think it is great idea, I will also find it handy
That wstring issue... I'm also dealing with it at the moment in one project, but no solution so far

   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5525
@Raziel
Wstring stuff is about unicode wide characters (which half implemented if i remember right). So to make it works you can do as Alfkil do for his QT port:

namespace std
{
typedef basic_string<wchar_twstring;
}


Cant say how good that hack is, but probably all will works fine except parts where some non-standard text characters will be used in some text.

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2734
@Raziel


If your have "using namespace std; "

Then the following lines, is assumed that is inside std namespace, so you do not need "std::" in the typedef, because it know it's this you're talking about.

So it should be fine to do:

typedef string AnsiString;
typedef string Utf8String;
typedef wstring WideString;


_________________
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
   Report Go to top

Re: Porting to AmigaOS4 thread
Just popping in
Joined:
2008/8/21 0:11
Posts: 69
I've always wanted to know what to do about a program that calls fork().

It's a basic POSIX thing that we don't have on the Amiga.

Thanks!
Bill "tekmage" Borsari

   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2734
@tekmage

fork() is Linux kernel thing, it's not posix thing. use pthreads or threads in C++11.

the thing to do is look for Windows workaround for it, as its not supported in windows as well.

_________________
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
   Report Go to top

Re: Porting to AmigaOS4 thread
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 797
@LiveForIt

Sure? http://man7.org/linux/man-pages/man2/fork.2.html

"POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD."

   Report Go to top

Re: Porting to AmigaOS4 thread
Quite a regular
Joined:
2007/7/14 20:30
From Lothric
Posts: 797
@tekmage

Which program you are referring to?

   Report Go to top

Re: Porting to AmigaOS4 thread
Quite a regular
Joined:
2007/2/27 10:47
From Gravity well
Posts: 654
fork()'s so POSIX

I read that as "any program that calls fork()".

--

Suggestions for this sort of thing? to_string doesn't seem to be in std
#include <string>

    
int main()
    {
        
std::to_string(0);
        return 
0;
    }


Edited by Thematic on 2019/2/14 0:57:56
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2007/1/26 21:48
From New Zealand
Posts: 2196
@Thematic

Quote:

Suggestions for this sort of thing? to_string doesn't seem to be in std

You need C++11 for std::to_string() (see here. So add -std=c++11 or -std=gnu++11 to the compiler's command line parameters. You may also need to use a newer version of GCC.

Hans

_________________
http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more.
https://keasigmadelta.com/ - more of my work
   Report Go to top

Re: Porting to AmigaOS4 thread
Quite a regular
Joined:
2007/2/27 10:47
From Gravity well
Posts: 654
@Hans
gcc is 8.1.0. I've tried lots of things. Even with space marines it won't make any difference.

   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2007/1/26 21:48
From New Zealand
Posts: 2196
@Thematic

Oops! I forgot that I also tweaked one of the header files. Details are here (down the bottom). Switching to clib2 may also work, although you may find that other functions are missing then.

Hans

_________________
http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more.
https://keasigmadelta.com/ - more of my work
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5525
@Thematic
Alternatively, if you do not want to touch system headers as Hans show, you can do some workaround like we do in Barony:

#ifdef __amigaos4__
    
char buff[50] = {0};
    
sprintf(buff"savegames/savegame%d"saveIndex);
    
std::string filename buff;
#else
    
std::string filename "savegames/savegame" std::to_string(saveIndex);
#endif


_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a story that hasn't been written yet
Posts: 3528
@kas1e

Thank you, that workaround did the trick.

@Liveforit

Unfortunately that fix doesn't work.
The error changes and the suggested fix does too, but it still breaks.

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr.
   Report Go to top

Re: Porting to AmigaOS4 thread
Just can't stay away
Joined:
2006/11/30 11:30
From Finland
Posts: 1687
@Raziel

An alternative fix for missing std::to_string and std::wstring.

#ifdef __amigaos4__
namespace std {
    
template <typename Tstring to_string(const &n) {
        
ostringstream strm;
        
strm << n;
        return 
strm.str();
    }

    
typedef basic_string<wchar_twstring;
}
#endif


   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a story that hasn't been written yet
Posts: 3528
@salass00

Thank you, works too.

This will hopefully become a nice lookup thread for common (porting) problems.

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr.
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a story that hasn't been written yet
Posts: 3528
Next issue...i tried to build (after a year long hiatus) ScummVM with SDL1 (for test cases), but i get a linker error
LINK     scummvm
backends
/platform/sdl/sdl.oIn function `OSystem_SDL::setupGraphicsModes()':
backends/platform/sdl/sdl.cpp:721: undefined reference to 
`SdlAudioCDManager::SdlAudioCDManager()'
gmake: *** [scummvm] Error 1

which is strange, because everything else is picked up correctly and i have the latest SD1 installed

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr.
   Report Go to top

Re: Porting to AmigaOS4 thread
Quite a regular
Joined:
2013/10/17 15:21
From Hungary
Posts: 599
SDL is written in C, so the SdlAudioCDManager class probably belongs to ScummVM.

_________________
I see the jimmies have been rustled.
   Report Go to top

Re: Porting to AmigaOS4 thread
Home away from home
Joined:
2006/11/26 21:45
From a story that hasn't been written yet
Posts: 3528
@BSzili

So, it might be a missing #include in the ScummVM code?

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr.
   Report Go to top

Re: Porting to AmigaOS4 thread
Quite a regular
Joined:
2007/2/27 10:47
From Gravity well
Posts: 654
@Raziel

I think missing includes are caught in compilation, unless something weird was attempted maybe? Linking undefined reference suggests missing library, which is all too common. For instance library a could depend on library b, so -la is not enough. Also the order they are in the command line may make a difference.

I learned half the things from this http://www.os4depot.net/index.php?fun ... ment/manual/spots-pfd.lha

   Report Go to top


(1) 2 3 4 ... 8 »



[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project