{"action":"created","issue":{"url":"https://api.github.com/repos/gflags/gflags/issues/111","labels_url":"https://api.github.com/repos/gflags/gflags/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/gflags/gflags/issues/111/comments","events_url":"https://api.github.com/repos/gflags/gflags/issues/111/events","html_url":"https://github.com/gflags/gflags/issues/111","id":64473124,"number":111,"title":"Problem Linker os-x and DECLARE","user":{"login":"sducomman","id":8588880,"avatar_url":"https://avatars.githubusercontent.com/u/8588880?v=3","gravatar_id":"","url":"https://api.github.com/users/sducomman","html_url":"https://github.com/sducomman","followers_url":"https://api.github.com/users/sducomman/followers","following_url":"https://api.github.com/users/sducomman/following{/other_user}","gists_url":"https://api.github.com/users/sducomman/gists{/gist_id}","starred_url":"https://api.github.com/users/sducomman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sducomman/subscriptions","organizations_url":"https://api.github.com/users/sducomman/orgs","repos_url":"https://api.github.com/users/sducomman/repos","events_url":"https://api.github.com/users/sducomman/events{/privacy}","received_events_url":"https://api.github.com/users/sducomman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-26T08:54:16Z","updated_at":"2015-03-26T11:26:32Z","closed_at":null,"body":"Hello,\r\nI use gflags via ortools, but recently I have made an update of ortools and I have problem of linker with the library gflags. \r\nThe version used of gflags is 2.1.1 and I have tested on windows and mac.\r\nOn mac, with the example :\r\n\r\n```\r\n#include <gflags/gflags.h>\r\nDECLARE_int64(myInt);\r\nDEFINE_int64(deu, 64, \"test\");\r\nint main(int argc, char ** argv) {\r\n    gflags::ParseCommandLineFlags( &argc, &argv, true);\r\n    std::cout << FLAGS_myInt << std::endl;\r\n    std::cout << FLAGS_deu << std::endl;\r\n    return 0;\r\n}\r\n```\r\n\r\nI have the following error : \r\nUndefined symbols for architecture x86_64:\r\n  \"fLI64::FLAGS_myInt\", referenced from:\r\n      _main in main.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\nSorry for the inconvenience, especially as I didn't know gflags without ortools.\r\n\r\nThank you in advance,\r\n\r\n--\r\nSylvain Ducomman"},"comment":{"url":"https://api.github.com/repos/gflags/gflags/issues/comments/86468126","html_url":"https://github.com/gflags/gflags/issues/111#issuecomment-86468126","issue_url":"https://api.github.com/repos/gflags/gflags/issues/111","id":86468126,"user":{"login":"schuhschuh","id":975451,"avatar_url":"https://avatars.githubusercontent.com/u/975451?v=3","gravatar_id":"","url":"https://api.github.com/users/schuhschuh","html_url":"https://github.com/schuhschuh","followers_url":"https://api.github.com/users/schuhschuh/followers","following_url":"https://api.github.com/users/schuhschuh/following{/other_user}","gists_url":"https://api.github.com/users/schuhschuh/gists{/gist_id}","starred_url":"https://api.github.com/users/schuhschuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schuhschuh/subscriptions","organizations_url":"https://api.github.com/users/schuhschuh/orgs","repos_url":"https://api.github.com/users/schuhschuh/repos","events_url":"https://api.github.com/users/schuhschuh/events{/privacy}","received_events_url":"https://api.github.com/users/schuhschuh/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T11:26:32Z","updated_at":"2015-03-26T11:26:32Z","body":"Hi Sylvain,\r\n\r\nthe linker correctly indicates the problem. You have only declared the global FLAGS_myint variable via DECLARE_int64, but not defined it in this compilation unit (.cc/.cxx/.cpp file). The DECLARE_int64 macro should enable you to use a flag in a compilation unit which is defined in another compilation unit or library. If you replace DECLARE_int64 by DEFINE_int64 the linker error should go away for this example.\r\n\r\nIf you encounter such linker error with a more complicated actual application set up, you need to check whether and where (i.e., in which .cc file or library) the flag is DEFINE'd. Then you must ensure that the respective object file or library is part of the linker command.\r\n\r\nBest,\r\nAndreas"}}