{"action":"created","issue":{"url":"https://api.github.com/repos/halide/Halide/issues/921","labels_url":"https://api.github.com/repos/halide/Halide/issues/921/labels{/name}","comments_url":"https://api.github.com/repos/halide/Halide/issues/921/comments","events_url":"https://api.github.com/repos/halide/Halide/issues/921/events","html_url":"https://github.com/halide/Halide/issues/921","id":103611008,"number":921,"title":"Linking multiple compiled .obj files in the same project","user":{"login":"winding","id":3420882,"avatar_url":"https://avatars.githubusercontent.com/u/3420882?v=3","gravatar_id":"","url":"https://api.github.com/users/winding","html_url":"https://github.com/winding","followers_url":"https://api.github.com/users/winding/followers","following_url":"https://api.github.com/users/winding/following{/other_user}","gists_url":"https://api.github.com/users/winding/gists{/gist_id}","starred_url":"https://api.github.com/users/winding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winding/subscriptions","organizations_url":"https://api.github.com/users/winding/orgs","repos_url":"https://api.github.com/users/winding/repos","events_url":"https://api.github.com/users/winding/events{/privacy}","received_events_url":"https://api.github.com/users/winding/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-27T22:52:03Z","updated_at":"2015-08-27T22:58:39Z","closed_at":null,"body":"I am using Halide for windows in Microsoft Visual Studio 2013. I separately compile two Halide functions into .h and .obj files. When I try to call either of them separately in a program, I get no errors. However, if I include and link to both of them in the same project, I get LINKING errors.\r\n\r\nThe snapshot of the error message is included. It seems that in each .obj file there are some common macros defined. I guess including more than one .obj file the compiler will complain about the redefinition of those common macros.\r\n\r\n![halide_error](https://cloud.githubusercontent.com/assets/3420882/9535194/a4c63742-4cec-11e5-8e14-4778f4bb8368.png)\r\n\r\nI am new to Halide, so it is also possible that I misunderstand its usage. So I would appreciate if anybody could elaborate on this or point out my misunderstandings.\r\n"},"comment":{"url":"https://api.github.com/repos/halide/Halide/issues/comments/135577954","html_url":"https://github.com/halide/Halide/issues/921#issuecomment-135577954","issue_url":"https://api.github.com/repos/halide/Halide/issues/921","id":135577954,"user":{"login":"abadams","id":515398,"avatar_url":"https://avatars.githubusercontent.com/u/515398?v=3","gravatar_id":"","url":"https://api.github.com/users/abadams","html_url":"https://github.com/abadams","followers_url":"https://api.github.com/users/abadams/followers","following_url":"https://api.github.com/users/abadams/following{/other_user}","gists_url":"https://api.github.com/users/abadams/gists{/gist_id}","starred_url":"https://api.github.com/users/abadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadams/subscriptions","organizations_url":"https://api.github.com/users/abadams/orgs","repos_url":"https://api.github.com/users/abadams/repos","events_url":"https://api.github.com/users/abadams/events{/privacy}","received_events_url":"https://api.github.com/users/abadams/received_events","type":"User","site_admin":false},"created_at":"2015-08-27T22:58:39Z","updated_at":"2015-08-27T22:58:39Z","body":"Every object file generated by Halide contains a complete copy of the\nruntime. On linux and OS X this is silently resolved using weak linkage.\nWindows doesn't do weak linkage. You have a few options:\n\n1) Tell the linker to ignore duplicate symbols with /FORCE:MULTIPLE\n2) Compile your pipelines without the runtime using the target flag\nTarget::NoRuntime, then link in a separate copy of the runtime (any Halide\ngenerator binary can make one for you with the -r command line flag).\n3) Compile all your pipelines except for one with Target::NoRuntime.\n\nOn Thu, Aug 27, 2015 at 3:52 PM, winding <notifications@github.com> wrote:\n\n> I am using Halide for windows in Microsoft Visual Studio 2013. I\n> separately compile two Halide functions into .h and .obj files. When I try\n> to call either of them separately in a program, I get no errors. However,\n> if I include and link to both of them in the same project, I get LINKING\n> errors.\n>\n> The snapshot of the error message is included. It seems that in each .obj\n> file there are some common macros defined. I guess including more than one\n> .obj file the compiler will complain about the redefinition of those common\n> macros.\n>\n> [image: halide_error]\n> <https://cloud.githubusercontent.com/assets/3420882/9535194/a4c63742-4cec-11e5-8e14-4778f4bb8368.png>\n>\n> I am new to Halide, so it is also possible that I misunderstand its usage.\n> So I would appreciate if anybody could elaborate on this or point out my\n> misunderstandings.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/halide/Halide/issues/921>.\n>\n"}}