Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
123 user(s) are online (91 user(s) are browsing Forums)

Members: 0
Guests: 123

more...

Support us!

Headlines

 
  Register To Post  

(1) 2 3 4 ... 22 »
Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
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

Go to top
Re: Porting to AmigaOS4 thread
Just popping in
Just popping in


See User information
@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

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@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!
AmigaOS4 on youtube
Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@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.
Go to top
Re: Porting to AmigaOS4 thread
Just popping in
Just popping in


See User information
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

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@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.
Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@LiveForIt

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

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

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@tekmage

Which program you are referring to?

Go to top
Re: Porting to AmigaOS4 thread
Quite a regular
Quite a regular


See User information
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
Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@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

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Porting to AmigaOS4 thread
Quite a regular
Quite a regular


See User information
@Hans
gcc is 8.1.0. I've tried lots of things. Even with space marines it won't make any difference.

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@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

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@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!
AmigaOS4 on youtube
Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@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.

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@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


Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@salass00

Thank you, works too.

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

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
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

Go to top
Re: Porting to AmigaOS4 thread
Quite a regular
Quite a regular


See User information
SDL is written in C, so the SdlAudioCDManager class probably belongs to ScummVM.

This is just like television, only you can see much further.
Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@BSzili

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

Go to top
Re: Porting to AmigaOS4 thread
Quite a regular
Quite a regular


See User information
@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

Go to top

  Register To Post
(1) 2 3 4 ... 22 »

 




Currently Active Users Viewing This Thread: 4 ( 0 members and 4 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project