Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9164575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:43:00+00:00 2026-06-17T14:43:00+00:00

Just trying to set up box2d world on Marmalade project brings access violation :

  • 0

Just trying to set up box2d world on Marmalade project brings access violation :

#include "s3e.h"
#include "Iw2D.h"
#include "game.h"
#include "Box2D\Box2D.h"

CGame::CGame()
: m_Position(0,0)
, m_Size(Iw2DGetSurfaceHeight() / 10, Iw2DGetSurfaceHeight() / 10)
{
b2Vec2 gravity(0.0f, -10.0f);
bool doSleep = true;
b2World world(gravity, doSleep); <------this line is the one
b2BodyDef groundBodyDef;
groundBodyDef.position.Set(0.0f, -10.0f);
b2Body* groundBody = world.CreateBody(&groundBodyDef);
b2PolygonShape groundBox;
groundBox.SetAsBox(50.0f, 10.0f);
groundBody->CreateFixture(&groundBox, 0.0f);

}

debugging it, shows that at b2Settings.cpp “malloc(1024)” causes access violation

     #include <Box2D/Common/b2Settings.h>
     #include <cstdlib>

     b2Version b2_version = {2, 2, 0};

     // Memory allocators. Modify these to use your own allocator.
     void* b2Alloc(int32 size)
    {
   return malloc(size); <----this is the one
     }

    void b2Free(void* mem)
   {
   free(mem);
   }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:43:01+00:00Added an answer on June 17, 2026 at 2:43 pm

    Exactly what iforce2d has said in the comment, you need to create a pointer to b2World and call new on it. You can’t directly call it’s constructor, without calling new on it. Obviously the correct statement would be –

    b2World* world = new b2World(gravity, doSleep); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering: I'm trying to set up an adaptive image handler in Coldfusion8, which
I'm trying to set up a slider that uses just one control-menu (e.g. Item
I'm trying to set the ForceCheckout property on an SPList item and it's just
I just started working using Google Maps API yesterday, and trying to set up
I am trying to do simple thing: I just need to set some cells
As a quick overview: I'm trying to make a game of pool using Box2D
I'm just trying to set and use a cookie but I can't seem to
I'm very new to Maven and am just now trying to set up my
was just trying to set up a canvas page for our app. Got empty
I'm just trying to set up an input with datepicker and I'm getting the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.