{"id":6936,"date":"2025-09-11T15:08:09","date_gmt":"2025-09-11T15:08:09","guid":{"rendered":"https:\/\/unitconversion.io\/blog\/?p=6936"},"modified":"2025-09-11T15:15:34","modified_gmt":"2025-09-11T15:15:34","slug":"how-to-fix-collect2-exe-error-ld-returned-1-exit-status","status":"publish","type":"post","link":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/","title":{"rendered":"How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d"},"content":{"rendered":"<p>You&#8217;re writing a cool C++ program. You click build. Instead of seeing smooth success, you get a nasty message:<\/p>\n<pre><code>collect2.exe: error: ld returned 1 exit status<\/code><\/pre>\n<p>What just happened? What is <i>collect2<\/i>? What does <i>ld<\/i> want from you? Don\u2019t worry. Take a breath. You&#8217;re not alone. This error pops up a lot, especially when you&#8217;re new or working with new code.<\/p>\n<p>This guide will walk through how to <b>fix this mysterious error<\/b>\u2014in plain, simple steps. Let\u2019s make this fun, like detective work with a compiler sidekick!<\/p>\n<h2>\ud83d\udca5 What&#8217;s Going On?<\/h2>\n<p>When you see this error, your code might have <i>compiled just fine<\/i>. But here&#8217;s the catch\u2014compiling isn&#8217;t the end. Your code also needs to be <b>linked<\/b>.<\/p>\n<p>The compiler turns your code into pieces called <i>object files<\/i>. Then the linker (which is usually <code>ld<\/code>) glues them all together into a final program. If something goes wrong in that gluing process, you\u2019ll see this error.<\/p>\n<h2>\ud83d\udd75\ufe0f\u200d\u2642\ufe0f Step 1: Read the Full Error Message<\/h2>\n<p>Right before <code>collect2.exe<\/code> complains, there\u2019s usually another error. That\u2019s the real troublemaker\u2014<b>pay attention to it<\/b>.<\/p>\n<p>For example, you might see something like:<\/p>\n<pre><code>undefined reference to `main'<\/code><\/pre>\n<p>Now that\u2019s useful! It means the linker couldn\u2019t find the <code>main<\/code> function, which every C++ program needs. Always scroll up and check what triggered <code>ld<\/code> to give up.<\/p>\n<h2>\ud83d\udd0d Step 2: Look for Common Causes<\/h2>\n<p>Let\u2019s go through the most common reasons for this error and how to fix each one.<\/p>\n<h3>1. <i>Missing main()<\/i><\/h3>\n<p>Every program needs a starting point. In C++, that\u2019s <code>int main()<\/code>.<\/p>\n<pre><code>int main() {\n    \/\/ your code\n    return 0;\n}<\/code><\/pre>\n<p>If your main is missing or has the wrong signature, the linker won&#8217;t know where to start.<\/p>\n<h3>2. <i>Forgetting to Compile All Files<\/i><\/h3>\n<p>Imagine you have two files:<\/p>\n<ul>\n<li><code>main.cpp<\/code><\/li>\n<li><code>mathutils.cpp<\/code><\/li>\n<\/ul>\n<p>Your <code>main.cpp<\/code> calls a function in <code>mathutils.cpp<\/code>. If you say:<\/p>\n<pre><code>g++ main.cpp<\/code><\/pre>\n<p>Oops! You&#8217;re only compiling <code>main.cpp<\/code>. The linker has no idea about <code>mathutils.cpp<\/code>.<\/p>\n<p>Fix: Compile them together:<\/p>\n<pre><code>g++ main.cpp mathutils.cpp<\/code><\/pre>\n<p>Or compile separately and then link:<\/p>\n<pre><code>g++ -c main.cpp\ng++ -c mathutils.cpp\ng++ main.o mathutils.o<\/code><\/pre>\n<h3>3. <i>Wrong Order of Flags or Files<\/i><\/h3>\n<p>Linkers can be picky. For example:<\/p>\n<pre><code>g++ -lm main.cpp<\/code><\/pre>\n<p>might fail if you&#8217;re using math functions like <code>sin()<\/code> or <code>sqrt()<\/code>. Want to know why?<\/p>\n<p>The <code>-lm<\/code> flag tells the compiler to link the <code>libm<\/code> (math) library. But in many compilers, the order matters!<\/p>\n<p>Always put libraries <b>after<\/b> source files:<\/p>\n<pre><code>g++ main.cpp -lm<\/code><\/pre>\n<p>Otherwise, the linker doesn\u2019t \u201csee\u201d the symbols when it needs them.<\/p>\n<h3>4. <i>Typos in Function Names<\/i><\/h3>\n<p>This one\u2019s sneaky. You declare a function like this:<\/p>\n<pre><code>void printMessage();<\/code><\/pre>\n<p>But define it like this:<\/p>\n<pre><code>void PrintMessage() {\n  \/\/ code\n}<\/code><\/pre>\n<p>Yes, C++ cares about case. If the function name doesn\u2019t match <b>exactly<\/b>, linker throws a tantrum.<\/p>\n<p>Tip: Copy the function name straight from the declaration to avoid typos.<\/p>\n<h3>5. <i>Missing or Wrong Libraries<\/i><\/h3>\n<p>If you\u2019re using external libraries like SDL, Boost, or OpenGL, make sure you\u2019re linking them correctly.<\/p>\n<p>Example for SDL2:<\/p>\n<pre><code>g++ main.cpp -lSDL2<\/code><\/pre>\n<p>If your system doesn&#8217;t know where SDL2 is, it will fail.<\/p>\n<p>Add path info if needed:<\/p>\n<pre><code>g++ main.cpp -I\/path\/to\/includes -L\/path\/to\/libs -lSDL2<\/code><\/pre>\n<img loading=\"lazy\" decoding=\"async\" width=\"1080\" height=\"1350\" src=\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/get-coding-and-coding-books-beside-cup-of-coffee-sdl2-opengl-coding-libraries-2.jpg\" class=\"attachment-full size-full\" alt=\"\" srcset=\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/get-coding-and-coding-books-beside-cup-of-coffee-sdl2-opengl-coding-libraries-2.jpg 1080w, https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/get-coding-and-coding-books-beside-cup-of-coffee-sdl2-opengl-coding-libraries-2-240x300.jpg 240w, https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/get-coding-and-coding-books-beside-cup-of-coffee-sdl2-opengl-coding-libraries-2-819x1024.jpg 819w, https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/get-coding-and-coding-books-beside-cup-of-coffee-sdl2-opengl-coding-libraries-2-768x960.jpg 768w\" sizes=\"(max-width: 1080px) 100vw, 1080px\" \/>\n<h3>6. <i>Mixing C and C++ Code<\/i><\/h3>\n<p>If you\u2019re calling C functions from a C++ file, you need to use <code>extern \"C\"<\/code>.<\/p>\n<p>Otherwise, names get mangled and the linker can\u2019t match them.<\/p>\n<pre><code>extern \"C\" {\n  #include \"something_from_c.h\"\n}<\/code><\/pre>\n<h2>\ud83d\udee0 Tools and Tips to Help<\/h2>\n<h3>Use <i>-Wall<\/i> and <i>-Wextra<\/i><\/h3>\n<p>They enable more warnings. Catch problems earlier.<\/p>\n<pre><code>g++ -Wall -Wextra main.cpp<\/code><\/pre>\n<h3>Try <i>-v<\/i> (verbose mode)<\/h3>\n<p>This one gives you a LOT of output, but it helps trace what\u2019s really going on.<\/p>\n<pre><code>g++ -v main.cpp<\/code><\/pre>\n<h3>Use an IDE<\/h3>\n<p>Tools like Visual Studio Code, CLion, or Code::Blocks can show which file isn&#8217;t being linked or compiled.<\/p>\n<img loading=\"lazy\" decoding=\"async\" width=\"1080\" height=\"810\" src=\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-close-up-of-a-computer-screen-with-code-on-it-code-blocks-ide-cpp-error.jpg\" class=\"attachment-full size-full\" alt=\"\" srcset=\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-close-up-of-a-computer-screen-with-code-on-it-code-blocks-ide-cpp-error.jpg 1080w, https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-close-up-of-a-computer-screen-with-code-on-it-code-blocks-ide-cpp-error-300x225.jpg 300w, https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-close-up-of-a-computer-screen-with-code-on-it-code-blocks-ide-cpp-error-1024x768.jpg 1024w, https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-close-up-of-a-computer-screen-with-code-on-it-code-blocks-ide-cpp-error-768x576.jpg 768w\" sizes=\"(max-width: 1080px) 100vw, 1080px\" \/>\n<h2>\ud83d\udea7 Real-World Example<\/h2>\n<p>Here\u2019s a super common mistake:<\/p>\n<p>Your project has <code>main.cpp<\/code> and <code>utils.cpp<\/code>. The header file is <code>utils.h<\/code>.<\/p>\n<p>You wrote this in <code>utils.h<\/code>:<\/p>\n<pre><code>void greet();<\/code><\/pre>\n<p>And in <code>utils.cpp<\/code>:<\/p>\n<pre><code>#include &lt;iostream&gt;\nvoid greet() {\n  std::cout &lt;&lt; \"Hello!\" &lt;&lt; std::endl;\n}<\/code><\/pre>\n<p>In <code>main.cpp<\/code>:<\/p>\n<pre><code>#include \"utils.h\"\nint main() {\n  greet();\n  return 0;\n}<\/code><\/pre>\n<p>You then run:<\/p>\n<pre><code>g++ main.cpp<\/code><\/pre>\n<p>Error! The linker can&#8217;t find <code>greet()<\/code>.<\/p>\n<p><b>Fix:<\/b><\/p>\n<pre><code>g++ main.cpp utils.cpp<\/code><\/pre>\n<p>Done! It works now!<\/p>\n<h2>\ud83d\ude80 Bonus: Understand What collect2.exe Is<\/h2>\n<p><code>collect2.exe<\/code> is part of GCC (the GNU Compiler Collection). It\u2019s not an error generator. It\u2019s more like an error <i>messenger<\/i>.<\/p>\n<p>When it tells you:<\/p>\n<pre><code>ld returned 1 exit status<\/code><\/pre>\n<p>It\u2019s like your friend saying, \u201cHey, ld (the linker) just tripped over something. You better check.&#8221; Listen to collect2, but focus on what ld said before it.<\/p>\n<h2>\ud83e\udde0 Recap: Checklist to Fix the Error<\/h2>\n<ol>\n<li>Check for any missing <code>main()<\/code>.<\/li>\n<li>Make sure you&#8217;re compiling <b>all needed source files<\/b>.<\/li>\n<li>Link libraries after the source files.<\/li>\n<li>Match function names exactly.<\/li>\n<li>Don\u2019t forget the right headers and paths.<\/li>\n<li>If mixing C and C++ files, use <code>extern \"C\"<\/code>.<\/li>\n<\/ol>\n<h2>\ud83c\udf89 Conclusion<\/h2>\n<p>Fixing <code>collect2.exe: error: ld returned 1 exit status<\/code> can feel like detective work. But once you know what to look for, it\u2019s not that scary.<\/p>\n<p>Remember\u2014this error means something went wrong during <i>linking<\/i>, not compiling. The real clues are<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You&#8217;re writing a cool C++ program. You click build. Instead of seeing smooth success, you get a nasty message: <a href=\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/\" class=\"read-more\">Read more<\/a><\/p>\n","protected":false},"author":79,"featured_media":6937,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[665],"tags":[],"class_list":["post-6936","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","no-featured-image-padding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d - Unit Conversion Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d - Unit Conversion Blog\" \/>\n<meta property=\"og:description\" content=\"You&#8217;re writing a cool C++ program. You click build. Instead of seeing smooth success, you get a nasty message: Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/\" \/>\n<meta property=\"og:site_name\" content=\"Unit Conversion Blog\" \/>\n<meta property=\"article:published_time\" content=\"2025-09-11T15:08:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-11T15:15:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-circular-maze-with-the-words-open-ai-on-it-sdl2-opengl-coding-libraries.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Olivia Brown\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Olivia Brown\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/\"},\"author\":{\"name\":\"Olivia Brown\",\"@id\":\"https:\/\/unitconversion.io\/blog\/#\/schema\/person\/4ea06b340c4660f4a04bd6d58c582b69\"},\"headline\":\"How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d\",\"datePublished\":\"2025-09-11T15:08:09+00:00\",\"dateModified\":\"2025-09-11T15:15:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/\"},\"wordCount\":729,\"publisher\":{\"@id\":\"https:\/\/unitconversion.io\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-circular-maze-with-the-words-open-ai-on-it-sdl2-opengl-coding-libraries.jpg\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/\",\"url\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/\",\"name\":\"How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d - Unit Conversion Blog\",\"isPartOf\":{\"@id\":\"https:\/\/unitconversion.io\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-circular-maze-with-the-words-open-ai-on-it-sdl2-opengl-coding-libraries.jpg\",\"datePublished\":\"2025-09-11T15:08:09+00:00\",\"dateModified\":\"2025-09-11T15:15:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#primaryimage\",\"url\":\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-circular-maze-with-the-words-open-ai-on-it-sdl2-opengl-coding-libraries.jpg\",\"contentUrl\":\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-circular-maze-with-the-words-open-ai-on-it-sdl2-opengl-coding-libraries.jpg\",\"width\":1080,\"height\":675},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/unitconversion.io\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/unitconversion.io\/blog\/#website\",\"url\":\"https:\/\/unitconversion.io\/blog\/\",\"name\":\"Unit Conversion Blog\",\"description\":\"On conversion and other things :)\",\"publisher\":{\"@id\":\"https:\/\/unitconversion.io\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/unitconversion.io\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/unitconversion.io\/blog\/#organization\",\"name\":\"Unit Conversion Blog\",\"url\":\"https:\/\/unitconversion.io\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/unitconversion.io\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2021\/01\/uclogo.png\",\"contentUrl\":\"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2021\/01\/uclogo.png\",\"width\":500,\"height\":500,\"caption\":\"Unit Conversion Blog\"},\"image\":{\"@id\":\"https:\/\/unitconversion.io\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/unitconversion.io\/blog\/#\/schema\/person\/4ea06b340c4660f4a04bd6d58c582b69\",\"name\":\"Olivia Brown\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/unitconversion.io\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/441e8f5d29c2bd1022936f38e27eee93?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/441e8f5d29c2bd1022936f38e27eee93?s=96&d=mm&r=g\",\"caption\":\"Olivia Brown\"},\"description\":\"I'm Olivia Brown, a tech enthusiast and freelance writer. My focus is on web development and digital tools, and I enjoy making complex tech topics easier to understand.\",\"url\":\"https:\/\/unitconversion.io\/blog\/author\/olivia\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d - Unit Conversion Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/","og_locale":"en_US","og_type":"article","og_title":"How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d - Unit Conversion Blog","og_description":"You&#8217;re writing a cool C++ program. You click build. Instead of seeing smooth success, you get a nasty message: Read more","og_url":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/","og_site_name":"Unit Conversion Blog","article_published_time":"2025-09-11T15:08:09+00:00","article_modified_time":"2025-09-11T15:15:34+00:00","og_image":[{"width":1080,"height":675,"url":"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-circular-maze-with-the-words-open-ai-on-it-sdl2-opengl-coding-libraries.jpg","type":"image\/jpeg"}],"author":"Olivia Brown","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Olivia Brown","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#article","isPartOf":{"@id":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/"},"author":{"name":"Olivia Brown","@id":"https:\/\/unitconversion.io\/blog\/#\/schema\/person\/4ea06b340c4660f4a04bd6d58c582b69"},"headline":"How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d","datePublished":"2025-09-11T15:08:09+00:00","dateModified":"2025-09-11T15:15:34+00:00","mainEntityOfPage":{"@id":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/"},"wordCount":729,"publisher":{"@id":"https:\/\/unitconversion.io\/blog\/#organization"},"image":{"@id":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#primaryimage"},"thumbnailUrl":"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-circular-maze-with-the-words-open-ai-on-it-sdl2-opengl-coding-libraries.jpg","articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/","url":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/","name":"How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d - Unit Conversion Blog","isPartOf":{"@id":"https:\/\/unitconversion.io\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#primaryimage"},"image":{"@id":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#primaryimage"},"thumbnailUrl":"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-circular-maze-with-the-words-open-ai-on-it-sdl2-opengl-coding-libraries.jpg","datePublished":"2025-09-11T15:08:09+00:00","dateModified":"2025-09-11T15:15:34+00:00","breadcrumb":{"@id":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#primaryimage","url":"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-circular-maze-with-the-words-open-ai-on-it-sdl2-opengl-coding-libraries.jpg","contentUrl":"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2025\/09\/a-circular-maze-with-the-words-open-ai-on-it-sdl2-opengl-coding-libraries.jpg","width":1080,"height":675},{"@type":"BreadcrumbList","@id":"https:\/\/unitconversion.io\/blog\/how-to-fix-collect2-exe-error-ld-returned-1-exit-status\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/unitconversion.io\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Fix \u201ccollect2.exe: error: ld returned 1 exit status\u201d"}]},{"@type":"WebSite","@id":"https:\/\/unitconversion.io\/blog\/#website","url":"https:\/\/unitconversion.io\/blog\/","name":"Unit Conversion Blog","description":"On conversion and other things :)","publisher":{"@id":"https:\/\/unitconversion.io\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/unitconversion.io\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/unitconversion.io\/blog\/#organization","name":"Unit Conversion Blog","url":"https:\/\/unitconversion.io\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/unitconversion.io\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2021\/01\/uclogo.png","contentUrl":"https:\/\/unitconversion.io\/blog\/wp-content\/uploads\/2021\/01\/uclogo.png","width":500,"height":500,"caption":"Unit Conversion Blog"},"image":{"@id":"https:\/\/unitconversion.io\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/unitconversion.io\/blog\/#\/schema\/person\/4ea06b340c4660f4a04bd6d58c582b69","name":"Olivia Brown","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/unitconversion.io\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/441e8f5d29c2bd1022936f38e27eee93?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/441e8f5d29c2bd1022936f38e27eee93?s=96&d=mm&r=g","caption":"Olivia Brown"},"description":"I'm Olivia Brown, a tech enthusiast and freelance writer. My focus is on web development and digital tools, and I enjoy making complex tech topics easier to understand.","url":"https:\/\/unitconversion.io\/blog\/author\/olivia\/"}]}},"_links":{"self":[{"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/posts\/6936"}],"collection":[{"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/users\/79"}],"replies":[{"embeddable":true,"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/comments?post=6936"}],"version-history":[{"count":1,"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/posts\/6936\/revisions"}],"predecessor-version":[{"id":6945,"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/posts\/6936\/revisions\/6945"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/media\/6937"}],"wp:attachment":[{"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/media?parent=6936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/categories?post=6936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitconversion.io\/blog\/wp-json\/wp\/v2\/tags?post=6936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}