Author Topic: crt2.o: No such file or directory  (Read 8288 times)

Offline SilverKobra

  • Single posting newcomer
  • *
  • Posts: 5
crt2.o: No such file or directory
« on: August 05, 2019, 12:55:48 am »
Hello everyone,
Whenever I build a cpp file I get the following error: ld.exe||cannot find crt2.o: No such file or directory|
I'm confused because I didn't apply changes of any sort to code::blocks files, the same programs that now are giving this error used to build and run just fine. In particular it happened that I was writing some code and when I built it the first time everything went fine, I just closed the PC and when I re opened the file later and built it again to make sure it worked (without changing anything) it gave the error I wrote at the beginning of the post and it seems to have ''spread'' to every other cpp file I try to build in code::blocks.
I tried to look for the crt2.o file in the original folder of C.B. but I didn't find anything (of course). I'm thinking of re installing C.B. but if the problem can be solved in other ways (if re installing cb is even a solution) I'd prefer that. Any help would be great

edit01: I've also noted that after building unsuccessfully a cpp file two files called project_name.depend and project_name.layout are created in the project folder, which didn't use to happen before.
I'm using the GNU GCC Compiler.
« Last Edit: August 05, 2019, 01:02:23 am by SilverKobra »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: crt2.o: No such file or directory
« Reply #1 on: August 05, 2019, 04:41:28 am »
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Edit1: Unless you post a build log, I will ignore your post as a waste of my time. Because without the build log I see no way to help you.

Tim S.
« Last Edit: August 05, 2019, 04:49:07 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline SilverKobra

  • Single posting newcomer
  • *
  • Posts: 5
Re: crt2.o: No such file or directory
« Reply #2 on: August 06, 2019, 04:59:09 pm »
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Edit1: Unless you post a build log, I will ignore your post as a waste of my time. Because without the build log I see no way to help you.

Tim S.

Here's the build log:

-------------- Build: Debug in Math (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-g++.exe  -o bin\Debug\Math.exe obj\Debug\main.o   
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find crt2.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))
 

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: crt2.o: No such file or directory
« Reply #3 on: August 06, 2019, 05:03:18 pm »
Make a rebuild as exactly described in the FAQ and post the log here... Also (as described in the faq) use code tags to post your build log. This is probably not enough information to help you

Blind guess: your file extension is .c instead of .cpp?

Offline SilverKobra

  • Single posting newcomer
  • *
  • Posts: 5
Re: crt2.o: No such file or directory
« Reply #4 on: August 06, 2019, 06:59:56 pm »
No my extension is .cpp
Code::Blocks version 13.12 on Windows 10 (version 1803). The compiler I use is GNU GCC Compiler version 5.1.0

Build log:
Code

-------------- Clean: Debug in Math (compiler: GNU GCC Compiler)---------------

Cleaned "Math - Debug"

-------------- Build: Debug in Math (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-g++.exe -Wall -fexceptions -g -std=c++11  -c D:\UTENTI\Pietro\Desktop\Math\main.cpp -o obj\Debug\main.o
x86_64-w64-mingw32-g++.exe  -o bin\Debug\Math.exe obj\Debug\main.o   
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find crt2.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 6 second(s))
1 error(s), 0 warning(s) (0 minute(s), 6 second(s))
 

Crash report:
Code::Blocks didn't crash


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: crt2.o: No such file or directory
« Reply #5 on: August 06, 2019, 07:42:36 pm »
Why do you use a 6 year old version of codeblocks?
anyway, this is not your problem..

this seems to be some 32bit and 64 bit miss mach...

First i would try to update codeblocks... second i would search for crt2.o. Then i would reinstall gcc, then i would install an other compiler...

Offline SilverKobra

  • Single posting newcomer
  • *
  • Posts: 5
Re: crt2.o: No such file or directory
« Reply #6 on: August 07, 2019, 03:04:52 am »
Idk really, it has been a long time since I used it
Can I solve all of this by simply disinstall CB and reinstalling it?
Thanks for your help

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: crt2.o: No such file or directory
« Reply #7 on: August 07, 2019, 08:06:26 am »
I !think! this is a compiler problem, so you should reinstall your compiler (remember codeblocks is not a compiler)

And i would update codebocks to a nightly, because there are a lot bug fixes and improvements (> 1000) since 13.12

Offline SilverKobra

  • Single posting newcomer
  • *
  • Posts: 5
Re: crt2.o: No such file or directory
« Reply #8 on: August 09, 2019, 01:20:23 am »
Problem solved, I installed an updated version of c.b. (17.12) and reinstalled the GCC compiler version 5.1.0-2 and everything seems to work fine. Thanks again for your help!
« Last Edit: August 09, 2019, 01:23:13 am by SilverKobra »