SFS2X + cocos2d-x c++

Post here your questions about the C++ API for SFS2X

Moderators: Lapo, Bax, MBagnati

tranthor
Posts: 8
Joined: 25 Oct 2018, 22:36

SFS2X + cocos2d-x c++

Postby tranthor » 26 Oct 2018, 02:11

Hi,
I'm trying to compile SFS2X in xCode 10 with cocos2d-x 3.17.
I read this guide: http://docs2x.smartfoxserver.com/GettingStarted/client-api-cpp-ios-xcode7
And i read about SpaceWar game: http://docs2x.smartfoxserver.com/ExamplesCpp/spacewar

However, when i try to compile my project, this is the error:

Code: Select all

Undefined symbols for architecture arm64:
  "Sfs2X::SmartFox::RemoveEventListener(boost::shared_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, boost::shared_ptr<Sfs2X::Util::DelegateOneArgument<boost::shared_ptr<Sfs2X::Core::BaseEvent> > >)", referenced from:
      ServerConnector::~ServerConnector() in TestSmartFoxServer-mobile-arm64-master.o
  "Sfs2X::SmartFox::SmartFox(bool)", referenced from:
      ServerConnector::initSmartFox() in TestSmartFoxServer-mobile-arm64-master.o
  "ServerConnector::GetInstance()", referenced from:
      OnConnection(unsigned long long, boost::shared_ptr<Sfs2X::Core::BaseEvent>) in TestSmartFoxServer-mobile-arm64-master.o
      OnConnectionLost(unsigned long long, boost::shared_ptr<Sfs2X::Core::BaseEvent>) in TestSmartFoxServer-mobile-arm64-master.o
  "Sfs2X::Core::SFSEvent::CONNECTION", referenced from:
      ServerConnector::initSmartFox() in TestSmartFoxServer-mobile-arm64-master.o
      ServerConnector::~ServerConnector() in TestSmartFoxServer-mobile-arm64-master.o
  "Sfs2X::SmartFox::ThreadSafeMode(bool)", referenced from:
      ServerConnector::initSmartFox() in TestSmartFoxServer-mobile-arm64-master.o
  "Sfs2X::SmartFox::Connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, long)", referenced from:
      ServerConnector::connect() in TestSmartFoxServer-mobile-arm64-master.o
  "Sfs2X::Core::BaseEvent::Params()", referenced from:
      ServerConnector::onConnected(boost::shared_ptr<Sfs2X::Core::BaseEvent>) in TestSmartFoxServer-mobile-arm64-master.o
  "Sfs2X::SmartFox::Disconnect()", referenced from:
      ServerConnector::~ServerConnector() in TestSmartFoxServer-mobile-arm64-master.o
  "Sfs2X::Core::SFSEvent::CONNECTION_LOST", referenced from:
      ServerConnector::initSmartFox() in TestSmartFoxServer-mobile-arm64-master.o
      ServerConnector::~ServerConnector() in TestSmartFoxServer-mobile-arm64-master.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Anyone can help me?
Thanks!!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X + cocos2d-x c++

Postby Lapo » 26 Oct 2018, 15:09

Just to be clear, did you succeed compiling the API but then have problems compiling the example?
Also what target are you compiling to? Is it Android?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
tranthor
Posts: 8
Joined: 25 Oct 2018, 22:36

Re: SFS2X + cocos2d-x c++

Postby tranthor » 26 Oct 2018, 15:36

Lapo wrote:Just to be clear, did you succeed compiling the API but then have problems compiling the example?
Also what target are you compiling to? Is it Android?

Thanks


No, i couldn't compile the example game.
I created a new project and i configured the xCode as indicated in the instalation/game guide. Including boost, openssl, sfs2x, etc. But i've that error.

What's your recommendation for solve it? I have no idea what change should I do.
Thanks.
tranthor
Posts: 8
Joined: 25 Oct 2018, 22:36

Re: SFS2X + cocos2d-x c++

Postby tranthor » 26 Oct 2018, 18:32

Lapo wrote:Also what target are you compiling to? Is it Android?


No, it's iOS.
xCode.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X + cocos2d-x c++

Postby Lapo » 27 Oct 2018, 15:02

Hi,
we did not create the example, so I will try to get in touch with original author and ask him to chime in.
Lapo

--

gotoAndPlay()

...addicted to flash games
tranthor
Posts: 8
Joined: 25 Oct 2018, 22:36

Re: SFS2X + cocos2d-x c++

Postby tranthor » 27 Oct 2018, 16:02

Ok, i will wait.
Anyway, do you know another examples? SFS2X + cocos2d-x.
tranthor
Posts: 8
Joined: 25 Oct 2018, 22:36

Re: SFS2X + cocos2d-x c++

Postby tranthor » 29 Oct 2018, 17:35

@Lapo

Do you have some news about this problem?
Or anothers working examples in c++ with sdf2x + cocos2d-x?...

I would like to use SFS2X but without help it's hard.. i hope anyone in this community can helps me..
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X + cocos2d-x c++

Postby Lapo » 30 Oct 2018, 08:49

I got in touch with the original developer and I hope he will get back to us soon and chime in here.
As regards other examples, no that's the only Cocos-2D example we have.

However, there is nothing really special about Cocos. Any C++ application can use the SFS2X client once it's compiled.
Unfortunately C++ is a complex beast when you want to go multi-platform, as you have to switch compilation environment and may encounter difficulties building a project for one platform or the other.

That's why we usually recommend C++ only for developers who are already experienced with the build environments they're targeting.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X + cocos2d-x c++

Postby Lapo » 02 Nov 2018, 08:23

Update
We got a reply from the demo's author, Dang

I checked the post, look like his complied libraries doesn’t support arm64 platform which is required by iOS platform from Apple, I guess this could comes from Boost library. Because your document only give a guidance to compile the Boost library on OSX platform(darwin64-x86_64) so actually if he goes to that tutorial, the library cannot works well with iOS platform for sure

He also says that he already added a compiled version of the Boost lib for iOS/arm64 in the sources folder and he suggests to use that.
Also keep in mind that, since the Boost lib is compiled for arm64 it won't work in the iOS Simulator (which is x86). So you will have to test using a device connected to your computer.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
tranthor
Posts: 8
Joined: 25 Oct 2018, 22:36

Re: SFS2X + cocos2d-x c++

Postby tranthor » 03 Nov 2018, 19:14

Lapo wrote:Update
We got a reply from the demo's author, Dang

I checked the post, look like his complied libraries doesn’t support arm64 platform which is required by iOS platform from Apple, I guess this could comes from Boost library. Because your document only give a guidance to compile the Boost library on OSX platform(darwin64-x86_64) so actually if he goes to that tutorial, the library cannot works well with iOS platform for sure

He also says that he already added a compiled version of the Boost lib for iOS/arm64 in the sources folder and he suggests to use that.
Also keep in mind that, since the Boost lib is compiled for arm64 it won't work in the iOS Simulator (which is x86). So you will have to test using a device connected to your computer.

Hope it helps


Ok, but what's the link for download Boost lib for iOS/arm64?
Should I download the SpaceWars again? http://docs2x.smartfoxserver.com/ExamplesCpp/spacewar
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X + cocos2d-x c++

Postby Lapo » 05 Nov 2018, 08:44

You should find the pre-compiled libs inside the SpaceWar example folder.
Under client/openssl-1.0.2j/

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
tranthor
Posts: 8
Joined: 25 Oct 2018, 22:36

Re: SFS2X + cocos2d-x c++

Postby tranthor » 07 Nov 2018, 22:49

Sorry, i tried but i can't.
If the SpaceWars creator wants to publish a new version on github or whatelse repo, it would be nice for me, because i can't compile on cocos2d-x 3.17 in iOS + xCode 10.

I would like to use SFS2X :(

Return to “SFS2X C++ API”

Who is online

Users browsing this forum: No registered users and 16 guests