{"action":"opened","issue":{"url":"https://api.github.com/repos/dartsim/dart/issues/478","labels_url":"https://api.github.com/repos/dartsim/dart/issues/478/labels{/name}","comments_url":"https://api.github.com/repos/dartsim/dart/issues/478/comments","events_url":"https://api.github.com/repos/dartsim/dart/issues/478/events","html_url":"https://github.com/dartsim/dart/issues/478","id":97863974,"number":478,"title":"Missing symbols because of default destructor","user":{"login":"mkoval","id":142251,"avatar_url":"https://avatars.githubusercontent.com/u/142251?v=3","gravatar_id":"","url":"https://api.github.com/users/mkoval","html_url":"https://github.com/mkoval","followers_url":"https://api.github.com/users/mkoval/followers","following_url":"https://api.github.com/users/mkoval/following{/other_user}","gists_url":"https://api.github.com/users/mkoval/gists{/gist_id}","starred_url":"https://api.github.com/users/mkoval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkoval/subscriptions","organizations_url":"https://api.github.com/users/mkoval/orgs","repos_url":"https://api.github.com/users/mkoval/repos","events_url":"https://api.github.com/users/mkoval/events{/privacy}","received_events_url":"https://api.github.com/users/mkoval/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-29T05:32:06Z","updated_at":"2015-07-29T05:32:06Z","closed_at":null,"body":"I have to manually link my project  against Nlopt to use the DART Nlopt wrapper on OS X. If I do not, I get this linking error:\r\n```\r\nUndefined symbols for architecture x86_64:\r\n  \"_nlopt_destroy\", referenced from:\r\n      nlopt::opt::~opt() in MoveHandStraightVectorField.cpp.o\r\nld: symbol(s) not found for architecture x86_64\r\n```\r\nI think what is happening is that:\r\n\r\n1. `NloptSolver` has a member variable of type `std::unique_ptr<nlopt::opt>`\r\n2. The `NloptSolver` destructor is defined as `default`\r\n3. Therefore, `NloptSolver::~NloptSolver` is instantiated in the user's code.\r\n4. The `std::unique_ptr<nlopt::opt>` destructor is not called inside DART.\r\n5. Therefore, the `std::unique_ptr<nlopt::opt>` is instantiated inside the user's code\r\n6. The user's code does not have the `_nlopt_destroy` symbol available, so linking fails.\r\n\r\nAs expected, manually defining the default constructor in the `NloptSolver.cpp` file solved the issue. In theory, this can happen *any time* we use the `default` keyword. The only foolproof solution I can think of is to stop using the `default` keyword entirely. :frowning: \r\n\r\nI discovered this because the OS X linker is *extremely* picky and will not use symbols that are included as part of a transitive dependency. I suspect that it could happen on other platforms, too.\r\n"}}