Author Topic: CRT2.O problem  (Read 23236 times)

Offline net

  • Single posting newcomer
  • *
  • Posts: 6
CRT2.O problem
« on: August 15, 2007, 01:10:24 am »
hi guys

im a c++ programmer, recently i ve installed windows vista then
codeblocks and i can't link even a hello world program!
on windows xp i ve compiled this succesfully but on vista it gives me the crt2.o error

ld says:

-------------- Build: Release in test ---------------
mingw32-gcc.exe -Wall -fexceptions -O2  -IC:\CB\include -IC:\CB\lib\gcc\mingw32\3.4.5\include -IC:\CB\include  -c C:\CB\TEST\test\main.c -o C:\CB\TEST\test\.objs\main.o
mingw32-g++.exe -LC:\CB\lib -LC:\CB\lib  -o test.exe C:\CB\TEST\test\.objs\main.o   -s 
ld: crt2.o: No such file: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 
i ve searched all over the internet about this bug but i cant find the solution to this problem
anyone knows how to link this?

thanks in advance

Offline net

  • Single posting newcomer
  • *
  • Posts: 6
Re: CRT2.O problem
« Reply #1 on: August 15, 2007, 01:11:35 am »
the crt2.o is installed and i am linking to it
its very strange this

the program was:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Hello world!\n");
    return 0;
}

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: CRT2.O problem
« Reply #2 on: August 15, 2007, 01:12:25 am »
If I recall correctly, you need to add a Windows environment variable named "GCC_EXEC_DIR" "GCC_EXEC_PREFIX" which points to the "lib" subdirectory (which contains crt2.o).
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline net

  • Single posting newcomer
  • *
  • Posts: 6
Re: CRT2.O problem
« Reply #3 on: August 15, 2007, 01:47:32 am »

i ve done that but it doesnt work
the crt2.o is still missing

Offline net

  • Single posting newcomer
  • *
  • Posts: 6
Re: CRT2.O problem
« Reply #4 on: August 15, 2007, 04:16:16 am »
i ve copied the crt2.o and the crtbegin.o to the base project folder AND IT WORKED UNDER WINDOWS VISTA
but nows ld give me this error



-------------- Build: Release in test ---------------
mingw32-gcc.exe -Wall -fexceptions -O2   -IC:\CB\include -IC:\CB\lib\gcc\mingw32\3.4.5\include -IC:\CB\include  -c C:\CB\TEST\test\main.c -o C:\CB\TEST\test\.objs\main.o
mingw32-g++.exe -LC:\CB\lib -LC:\CB\lib  -o test.exe C:\CB\TEST\test\.objs\main.o   -s -v 
Using built-in specs.
Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw special)
 ld -Bdynamic -o test.exe -s crt2.o crtbegin.o -LC:\CB\lib -LC:\CB\lib C:\CB\TEST\test\.objs\main.o -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt crtend.o
ld: cannot find -lgcc
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
 
the crt2.o and crtbegin.o is a bug in mingw

Offline net

  • Single posting newcomer
  • *
  • Posts: 6
Re: CRT2.O problem
« Reply #5 on: August 15, 2007, 08:16:32 pm »
i ve missed to add the path to libgcc.a then copied the crtend.o to the base project folder
now the project compiles and links!

UNDER WINDOWS VISTA YOU MUST HAVE CRT2.O, CRTBEGIN.O AND CRTEND.O
LOCATED ON THE BASE PROJECT FOLDER

IF YOU MISS TO DO THAT
LD WILL NOT LINK!
  :shock:

very truly yours
THE NET CENTINELL
« Last Edit: August 18, 2007, 05:46:03 pm by net »

juggernot

  • Guest
Re: CRT2.O problem
« Reply #6 on: December 26, 2007, 08:09:02 pm »
I'm having the same problem, code blocks can't seem to find crt2.o . I've tried linking to it. I can find crt2.o, crtbegin.o and crtend.o, but I don't know what I'm supposed to do exactly. What do you mean by the base project folder? The folder where all the projects are stored (that seems a little odd), or the base directory for code blocks?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: CRT2.O problem
« Reply #7 on: December 27, 2007, 10:02:04 pm »
I'm having the same problem, code blocks can't seem to find crt2.o . I've tried linking to it. I can find crt2.o, crtbegin.o and crtend.o, but I don't know what I'm supposed to do exactly.
UNDER WINDOWS VISTA YOU MUST HAVE CRT2.O, CRTBEGIN.O AND CRTEND.O
LOCATED ON THE BASE PROJECT FOLDER
I am using Vista myself - trust me this a *very* bad solution. The best you can do is either using a patched MinGW 3.4.5 binary (but that is C / C++ only) or use a pre-liminary version of the GCC4 branch. The latter is surely not yet ready for release but might work already. In terms of the 3.4.5'er one -> search the forums... there are plenty of links... one of it in one of my recent posts (forgot which one though... )
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5494
Re: CRT2.O problem
« Reply #8 on: December 27, 2007, 11:08:17 pm »
to be honest the mingw GCC 4.2.1 technology preview works rather well. Or maybe I don't do enough advanced things with it (I think debugging a CB [plug-in]/dll is still an issue, but maybe the newer gdb's solve this, I still need to investigate ..)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: CRT2.O problem
« Reply #9 on: December 28, 2007, 03:38:56 pm »
to be honest the mingw GCC 4.2.1 technology preview works rather well.
Let me put it this way:
You wouldn't want to try to convince your boss using this GCC pre-release version in a production code given to your customers (at least with MinGW) ;-).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: CRT2.O problem
« Reply #10 on: December 29, 2007, 03:17:20 am »
to be honest the mingw GCC 4.2.1 technology preview works rather well.
Let me put it this way:
You wouldn't want to try to convince your boss using this GCC pre-release version in a production code given to your customers (at least with MinGW) ;-).

Is great to have a boss like I have, who doesn't even know what a compiler is, and if he sees the software working then everything is OK, :D but in the other hand he also doesn't understand the work i have to pass to get things working  :(