{"id":1249,"date":"2022-08-30T15:14:52","date_gmt":"2022-08-30T15:14:52","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/10\/kdevelop-editing-cmakelists-txt-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:14:52","modified_gmt":"2022-08-30T15:14:52","slug":"kdevelop-editing-cmakelists-txt-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/kdevelop-editing-cmakelists-txt-collection-of-common-programming-errors\/","title":{"rendered":"kdevelop: editing CMakeLists.txt-Collection of common programming errors"},"content":{"rendered":"<p>I am having troubles trying to make my project work with kdevelop.<\/p>\n<p>In the CMakeLists.txt I have included the paths to the libraries that I use:<\/p>\n<pre><code>cmake_minimum_required(VERSION 2.4.6)\nPROJECT(Ormapi)\nINCLUDE_DIRECTORIES(\"\/dir\/whatever\/local\/dir\/include\") &lt; here is defined global.h\nINCLUDE_DIRECTORIES(\"\/dir\/whatever\/local\/src\")    \n\nADD_EXECUTABLE(Ormapi main.cpp OrmAPI.cpp)\n<\/code><\/pre>\n<p>main.cpp uses an instance of the class I have defined in OrmAPI.cpp. The problem is when I try to create an instance of any other class defined in the above included_directories, I get the both errors &#8220;undefined reference to &#8221; and &#8220;undefined reference to &#8220;.<\/p>\n<p>This is the call from the constructor of OrmAPI.cpp (Global is the class that exists inside the included directories):<\/p>\n<pre><code>OrmAPI::OrmAPI(){        \n Global::dirs()-&gt;addResourceDir(\"mydir\");    \n\n}\n<\/code><\/pre>\n<p>I am 99% sure that it is related with the CMakeLists.txt, but I do not know what on Earth can be happening.<\/p>\n<p>Any directions?<\/p>\n<ol>\n<li>\n<p>Finally found the problem:<\/p>\n<pre><code>cmake_minimum_required(VERSION 2.4.6)\nPROJECT(Ormapi)\nINCLUDE_DIRECTORIES(\"\/dir\/whatever\/local\/dir\/include\") &lt; here is defined global.h\nINCLUDE_DIRECTORIES(\"\/dir\/whatever\/local\/src\")    \n\nADD_EXECUTABLE(Ormapi main.cpp OrmAPI.cpp)\ntarget_link_libraries(Ormapi \/dirdir\/lib.so)<\/code><\/pre>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-10 00:12:09. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I am having troubles trying to make my project work with kdevelop. In the CMakeLists.txt I have included the paths to the libraries that I use: cmake_minimum_required(VERSION 2.4.6) PROJECT(Ormapi) INCLUDE_DIRECTORIES(&#8220;\/dir\/whatever\/local\/dir\/include&#8221;) &lt; here is defined global.h INCLUDE_DIRECTORIES(&#8220;\/dir\/whatever\/local\/src&#8221;) ADD_EXECUTABLE(Ormapi main.cpp OrmAPI.cpp) main.cpp uses an instance of the class I have defined in OrmAPI.cpp. The problem is when [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1249","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1249"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1249\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}