{"action":"closed","issue":{"url":"https://api.github.com/repos/CocoaLumberjack/CocoaLumberjack/issues/920","repository_url":"https://api.github.com/repos/CocoaLumberjack/CocoaLumberjack","labels_url":"https://api.github.com/repos/CocoaLumberjack/CocoaLumberjack/issues/920/labels{/name}","comments_url":"https://api.github.com/repos/CocoaLumberjack/CocoaLumberjack/issues/920/comments","events_url":"https://api.github.com/repos/CocoaLumberjack/CocoaLumberjack/issues/920/events","html_url":"https://github.com/CocoaLumberjack/CocoaLumberjack/issues/920","id":308756743,"number":920,"title":"Linking issue in Objective-C++ with THIS_FILE macro","user":{"login":"simonwagner","id":447190,"avatar_url":"https://avatars0.githubusercontent.com/u/447190?v=4","gravatar_id":"","url":"https://api.github.com/users/simonwagner","html_url":"https://github.com/simonwagner","followers_url":"https://api.github.com/users/simonwagner/followers","following_url":"https://api.github.com/users/simonwagner/following{/other_user}","gists_url":"https://api.github.com/users/simonwagner/gists{/gist_id}","starred_url":"https://api.github.com/users/simonwagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonwagner/subscriptions","organizations_url":"https://api.github.com/users/simonwagner/orgs","repos_url":"https://api.github.com/users/simonwagner/repos","events_url":"https://api.github.com/users/simonwagner/events{/privacy}","received_events_url":"https://api.github.com/users/simonwagner/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/CocoaLumberjack/CocoaLumberjack/milestones/28","html_url":"https://github.com/CocoaLumberjack/CocoaLumberjack/milestone/28","labels_url":"https://api.github.com/repos/CocoaLumberjack/CocoaLumberjack/milestones/28/labels","id":3273768,"number":28,"title":"3.4.2","description":"","creator":{"login":"bpoplauschi","id":154913,"avatar_url":"https://avatars2.githubusercontent.com/u/154913?v=4","gravatar_id":"","url":"https://api.github.com/users/bpoplauschi","html_url":"https://github.com/bpoplauschi","followers_url":"https://api.github.com/users/bpoplauschi/followers","following_url":"https://api.github.com/users/bpoplauschi/following{/other_user}","gists_url":"https://api.github.com/users/bpoplauschi/gists{/gist_id}","starred_url":"https://api.github.com/users/bpoplauschi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpoplauschi/subscriptions","organizations_url":"https://api.github.com/users/bpoplauschi/orgs","repos_url":"https://api.github.com/users/bpoplauschi/repos","events_url":"https://api.github.com/users/bpoplauschi/events{/privacy}","received_events_url":"https://api.github.com/users/bpoplauschi/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":12,"state":"closed","created_at":"2018-04-17T13:21:52Z","updated_at":"2018-04-17T17:47:53Z","due_on":null,"closed_at":"2018-04-17T13:25:23Z"},"comments":2,"created_at":"2018-03-26T22:24:37Z","updated_at":"2018-04-17T17:47:53Z","closed_at":"2018-04-17T17:47:53Z","author_association":"NONE","body":"### New Issue Checklist\r\n\r\n* [x] I have read and understood the [CONTRIBUTING guide](https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/.github/CONTRIBUTING.md)\r\n* [x] I have read the [Documentation](https://github.com/CocoaLumberjack/CocoaLumberjack#documentation) or [CocoaDocs](cocoadocs.org/docsets/CocoaLumberjack)\r\n* [x] I have searched for a similar issue in the [project](https://github.com/CocoaLumberjack/CocoaLumberjack/issues) and found none\r\n\r\n### Issue Info\r\n\r\n Info                    | Value                               |\r\n-------------------------|-------------------------------------|\r\n Platform Name           | osx\r\n Platform Version        | 10.12\r\n CocoaLumberjack Version | 2.3.0\r\n Integration Method      | manually\r\n Xcode Version           | Xcode 8.3\r\n Repro rate              | all the time (100%)\r\n Demo project link       | \r\n\r\n### Issue Description and Steps\r\n\r\nWhen using the `THIS_FILE` macro in an Objective-C++ file (.mm), I get the following linker error:\r\n\r\n```\r\nUndefined symbols for architecture x86_64:\r\n  \"DDExtractFileNameWithoutExtension(char const*, signed char)\", referenced from:\r\n      -[SomeClass someMethod] in SomeClass.o\r\nld: symbol(s) not found for architecture x86_64\r\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\r\n```\r\n\r\nThis is caused by not declaring the `DDExtractFileNameWithoutExtension` method as `extern \"C\"` which we unfortunately have to do if we want to call C functions from C++ (or in this case, Objective-C++).\r\n\r\nThe solution is to add the following:\r\n\r\n```\r\n#ifdef __cplusplus\r\n    #define DDLOG_EXTERN_C extern \"C\"\r\n#else\r\n    #define DDLOG_EXTERN_C\r\n#endif\r\n\r\nDDLOG_EXTERN_C NSString * DDExtractFileNameWithoutExtension(const char *filePath, BOOL copy);\r\n```\r\n\r\n"}}
{"actor":{"display_login":"bpoplauschi"}}