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 8177311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:28:35+00:00 2026-06-06T23:28:35+00:00

In my code, I have function prototype void AddBenchNode(ref_ptr<Group> root ,ref_ptr<Node> benches, bool setAttitude

  • 0

In my code, I have function prototype

void AddBenchNode(ref_ptr<Group> root ,ref_ptr<Node> benches, bool setAttitude = false, float scale_x =.15, float scale_y =15, float scale_z = 15, int position_x = 250, int position_y = 100, int position_z =0 );

where ref_ptr is a smart pointer.

In my main function, I define 2 smartpointers of type ref_ptr and ref_ptr and pass them to a call to my function, AddBenchNode.

ref_ptr<Group> root = new Group();
ref_ptr<Node> benches = readNodeFile("Models/test.ive");
AddBenchNode(root, benches, true);

When the call executes, nothing happens. As in no changes are made to the root pointer. What I want to know is if I am making this call correctly as I have it? Or do I have to re-define my function to take pointers to these smartpointers?

Now I did try passing by reference

void AddBenchNode(osg::ref_ptr<osg::Group>& root ,osg::ref_ptr<osg::Node>& benches, bool setAttitude = false, float scale_x =.15, float scale_y =15, float scale_z = 15, int position_x = 250, int position_y = 100, int position_z =0 );

That resulted in some linker errors.

Error 2 error LNK2001: unresolved external symbol “void __cdecl AddBenchNode(class osg::ref_ptr &,class osg::ref_ptr &,bool,float,float,float,int,int,int)” (?AddBenchNode@@YAXAAV?$ref_ptr@VGroup@osg@@@osg@@AAV?$ref_ptr@VNode@osg@@@2@_NMMMHHH@Z)
Error 3 error LNK1120: 1 unresolved externals

  • 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-06T23:28:36+00:00Added an answer on June 6, 2026 at 11:28 pm

    You’re passing the (smart) pointer by value. This means that caller and callee will share the same object, but have separate copies of the pointer. Changes the function makes to the object will be visible to the caller. But if the function makes a pointer to a brand-new object, it doesn’t affect the caller’s pointer, which still points to the old object.

    If you want to rebind the caller’s pointer, you need to pass the pointer by pointer or reference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple code fragment in JS working with prototype inheritance. function object(o)
I have a function whose prototype is as follows: void foo(const char * data);
I have a C function with prototype, void* VoidPointer(void*); Now I need to marshal
I have the following code in PhoneGap iPhone, in file Geofence.js Geofence.prototype.subscribeToLayer = function(layerName,circularRadius,successCallback){
Consider this JavaScript code snippet: Object.prototype.log = function() { // here, you have a
In my Java code I have function that gets file from the client in
I have code like function populate...() { var user = $.storage.get(particulars); if (user) {
When we have code like: function a(){ var x =0; this.add=function(){ alert(x++); } }
this is function.php of a wordpress theme that NOD32 says this code have a
I have a function(please see code below) which reads some data from the web.

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.