{"action":"created","issue":{"url":"https://api.github.com/repos/adobe-type-tools/afdko/issues/56","labels_url":"https://api.github.com/repos/adobe-type-tools/afdko/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/adobe-type-tools/afdko/issues/56/comments","events_url":"https://api.github.com/repos/adobe-type-tools/afdko/issues/56/events","html_url":"https://github.com/adobe-type-tools/afdko/issues/56","id":85503652,"number":56,"title":"roundf is not included in math.h for Visual Studio 2010","user":{"login":"anthrotype","id":6939968,"avatar_url":"https://avatars.githubusercontent.com/u/6939968?v=3","gravatar_id":"","url":"https://api.github.com/users/anthrotype","html_url":"https://github.com/anthrotype","followers_url":"https://api.github.com/users/anthrotype/followers","following_url":"https://api.github.com/users/anthrotype/following{/other_user}","gists_url":"https://api.github.com/users/anthrotype/gists{/gist_id}","starred_url":"https://api.github.com/users/anthrotype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthrotype/subscriptions","organizations_url":"https://api.github.com/users/anthrotype/orgs","repos_url":"https://api.github.com/users/anthrotype/repos","events_url":"https://api.github.com/users/anthrotype/events{/privacy}","received_events_url":"https://api.github.com/users/anthrotype/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-05T10:39:28Z","updated_at":"2015-06-05T10:45:35Z","closed_at":null,"body":"although part of C99 standard, the `roundf` function was only included in MS Visual Studio only from version 2013:\r\nhttp://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx\r\n\r\nWhen I try to build the AFKDO using Visual Studio 2010, I get the following error:\r\n```\r\n\"C:\\UsersLocal\\cosimo.lupo\\Documents\\GitHub\\afdko\\FDK\\Tools\\Programs\\tx\\build\\win\\vc10\\tx.sln\" (Build target) (1) -> \"C:\\UsersLocal\\cosimo.lupo\\Documents\\GitHub\\afdko\\FDK\\Tools\\Programs\\tx\\build\\win\\vc10\\tx.vcxproj\" (default target)\r\n(2) ->\r\n(Link target) ->\r\n  absfont.lib(absfont_dump.obj) : error LNK2019: unresolved external symbol _roundf referenced in function _writeRea l [C:\\UsersLocal\\cosimo.lupo\\Documents\\GitHub\\afdko\\FDK\\Tools\\Programs\\tx\\build\\win\\vc10\\tx.vcxproj]\r\n  svgwrite.lib(svgwrite.obj) : error LNK2001: unresolved external symbol _roundf [C:\\UsersLocal\\cosimo.lupo\\Document s\\GitHub\\afdko\\FDK\\Tools\\Programs\\tx\\build\\win\\vc10\\tx.vcxproj]\r\n  ufowrite.lib(ufowrite.obj) : error LNK2001: unresolved external symbol _roundf [C:\\UsersLocal\\cosimo.lupo\\Document s\\GitHub\\afdko\\FDK\\Tools\\Programs\\tx\\build\\win\\vc10\\tx.vcxproj]\r\n  ..\\..\\..\\exe\\win\\release\\tx.exe : fatal error LNK1120: 1 unresolved externals [C:\\UsersLocal\\cosimo.lupo\\Documents \\GitHub\\afdko\\FDK\\Tools\\Programs\\tx\\build\\win\\vc10\\tx.vcxproj]\r\n```\r\n\r\nThere are three modules where the roundf is used, all in the lib: `absfont_dump.c`, `svgwrite.c` and `ufowrite.c`. Because of the unresolved external symbol, the tools `tx`, `mergeFonts` and `rotateFont` cannot be successfully built on Windows using vc10.\r\nThe *.sln files version read \"Visual Studio 2010\", and also the name of the folders for the Windows build is \"vc10\" (i.e. MS Visual Studio 2010). So one would expect to compile the AFDKO code with Visual Studio 2010.\r\n\r\nIf I define the `roundf` function like below, then I can successfully compile everything:\r\n\r\n```c\r\n/* roundf was only included in math.h as of MS Visual Studio 2013, so we must define our own. */\r\n#if _MSC_VER < 1800\r\nstatic float roundf(float num)\r\n{\r\n\tfloat integer = ceilf(num);\r\n\tif (num > 0)\r\n\t\treturn integer - num > 0.5f ? integer - 1.0f : integer;\r\n\treturn integer - num >= 0.5f ? integer - 1.0f : integer;\r\n}\r\n#endif\r\n```\r\n\r\n(I found the code for roundf [here](http://www.opensource.apple.com/source/JavaScriptCore/JavaScriptCore-721.26/wtf/MathExtras.h), but there's nothing special about it).\r\n\r\nHowever, the organization of the AFDKO sources is very complex and I don't know where to place this function so that I can include it in all the required modules.\r\n\r\nCould anybody help me out?"},"comment":{"url":"https://api.github.com/repos/adobe-type-tools/afdko/issues/comments/109256629","html_url":"https://github.com/adobe-type-tools/afdko/issues/56#issuecomment-109256629","issue_url":"https://api.github.com/repos/adobe-type-tools/afdko/issues/56","id":109256629,"user":{"login":"anthrotype","id":6939968,"avatar_url":"https://avatars.githubusercontent.com/u/6939968?v=3","gravatar_id":"","url":"https://api.github.com/users/anthrotype","html_url":"https://github.com/anthrotype","followers_url":"https://api.github.com/users/anthrotype/followers","following_url":"https://api.github.com/users/anthrotype/following{/other_user}","gists_url":"https://api.github.com/users/anthrotype/gists{/gist_id}","starred_url":"https://api.github.com/users/anthrotype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthrotype/subscriptions","organizations_url":"https://api.github.com/users/anthrotype/orgs","repos_url":"https://api.github.com/users/anthrotype/repos","events_url":"https://api.github.com/users/anthrotype/events{/privacy}","received_events_url":"https://api.github.com/users/anthrotype/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T10:45:35Z","updated_at":"2015-06-05T10:45:35Z","body":"I just noticed that the use of roundf function was introduced with this commit https://github.com/adobe-type-tools/afdko/commit/aeb21404f1729c3f68e31497c92e4fe5f59d823f"}}