Author Topic: crt2.o / Vista headaches, now with -v goodness.  (Read 17448 times)

Offline ironlizard

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: crt2.o / Vista headaches, now with -v goodness.
« Reply #15 on: July 19, 2007, 07:14:27 am »
I installed wxpack. Same problem.
Turns out all of this $#%# was completely unnecessary.
The fix is at http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.4.2_to_develop_Code::Blocks_(MSW)
(bottom of the page)

As follows:
 
Quote
undefined reference to `_imp__wxTheApp' (& others)

If you encounter this one, try changing your linker options.

   1. MENU: Settings->configure plugins->compiler->other->advanced options (for me it was Settings->Compiler->Other->Advance)
   2. Choose: "Link object files to executable".
   3. It should be: $linker -o $exe_output $libdirs $link_objects $libs $link_options

Worked for me. Original credits to rickg22 (see this thread) - rykon

And so ends this three day saga. The story of a quest to avoid using managed code with dependencies on just in time compiling frameworks is over. Now I can begin the task of ... *$%# it's been so long I forgot what the hell I needed this for. Well, at any rate, I can now rest assured that whatever task I had set myself to, before this untimely failure set off my attention deficit difficulties, can now be accomplished with relative ease. Or something.

Offline ironlizard

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: crt2.o / Vista headaches, now with -v goodness.
« Reply #16 on: July 19, 2007, 10:42:51 am »
Wait, what? Why? Everything is working now. Will editing mingw.bat remind me of the incredibly important task I've forgotten? Will it take out the trash I've completely forgotten until this very moment after being edited? I DON'T UNDERSTAND!

Offline net

  • Single posting newcomer
  • *
  • Posts: 6
Re: crt2.o / Vista headaches, now with -v goodness.
« Reply #17 on: August 18, 2007, 05:49:53 pm »
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

Offline ironlizard

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: crt2.o / Vista headaches, now with -v goodness.
« Reply #18 on: August 18, 2007, 07:12:57 pm »
GIVING THE LINKER A PROPER SET OF ARGUMENTS SEEMED TO WORK WITHOUT THE NEED FOR STUFFING FILES IN THE PROJECT DIRECTORY THAT DON'T BELONG THERE BUT THANKS FOR THE REPLY. I THINK YOUR CAPS LOCK IS STUCK, BY THE WAY.

Offline theultramage

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: crt2.o / Vista headaches, now with -v goodness.
« Reply #19 on: September 03, 2007, 05:51:42 pm »
I'd like to note that this same problem still exists (C:BB mingw configuration sucks a lot).
After noticing the -v comment in the title, here's what I saw mingw-g++.exe invoke:
Quote
ld -Bdynamic -o bin\Debug\test.exe crt2.o crtbegin.o -LC:\Unix\bin\MinGW\lib obj\Debug\main.o -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt crtend.o
ld: crt2.o: No such file: No such file or directory
If you think about it, the error is clear. These are simple .o files, not libraries - therefore using -L won't help here.

I'd also like to point out that if I run the same initial command from the commandline, I get
Quote
ld -Bdynamic -o C:\test\bin\Debug\test.exe C:/Unix/bin/MinGW/lib/crt2.o C:/Unix/bin/MinGW/lib/gcc/mingw32/3.4.5/crtbegin.o -LC:\Unix\bin\MinGW\lib -LC:/Unix/bin/MinGW/lib/gcc/mingw32/3.4.5 -LC:/Unix/bin/MinGW/lib/gcc -LC:/Unix/bin/MinGW/mingw32/lib -LC:/Unix/bin/MinGW/lib C:\test\obj\Debug\main.o -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/Unix/bin/MinGW/lib/gcc/mingw32/3.4.5/crtend.o
and it links just fine. So who exactly is screwing up here?

Offline ironlizard

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: crt2.o / Vista headaches, now with -v goodness.
« Reply #20 on: September 03, 2007, 08:20:28 pm »
It's CB. As you can see in the results you got (I noticed this too when recompiling everything), CB doesn't expand the PATH variable for the object by default because the linker's arguments are incorrect. In the wrong order, or something, I forget.They might work under another OS, but not this one. Did you try changing the command line configuration in CB to this: $linker -o $exe_output $libdirs $link_objects $libs $link_options

It works. No seriously. Just do it, you'll thank me. Alternatively, you could go through that entire process that I did in the course of this thread. It's up to you man. Save yourself and run now.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2775
Re: crt2.o / Vista headaches, now with -v goodness.
« Reply #21 on: July 14, 2008, 07:02:35 pm »
It's CB. As you can see in the results you got (I noticed this too when recompiling everything), CB doesn't expand the PATH variable for the object by default because the linker's arguments are incorrect. In the wrong order, or something, I forget.They might work under another OS, but not this one. Did you try changing the command line configuration in CB to this: $linker -o $exe_output $libdirs $link_objects $libs $link_options

It works. No seriously. Just do it, you'll thank me. Alternatively, you could go through that entire process that I did in the course of this thread. It's up to you man. Save yourself and run now.

I changed all command line macros such that the pattern followed your suggestion of "$linker -o $exe_output $libdirs ..."

I still get the crt2.o not found error with TDM gcc 4.2.1 on Windows XP.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: crt2.o / Vista headaches, now with -v goodness.
« Reply #22 on: July 14, 2008, 08:27:46 pm »
I still get the crt2.o not found error with TDM gcc 4.2.1 on Windows XP.
This will only, and I mean only, result from an improper MinGW installation. Remove any and all environment variables relating to MinGW/GCC (including PATH entries), reinstall MinGW in an empty directory, and add an entry for the bin subdirectory to PATH (typically C:\MinGW\bin).

If an improperly installed GCC exists anywhere in PATH (or, for 4.2.x and earlier, in /mingw), you WILL have problems. Do NOT install MinGW on top of mSYS or mSYS on top of MinGW. Do NOT have Cygwin and MinGW in PATH at the same time.

If you only ever run MinGW/GCC from Code::Blocks, you don't even need an entry in PATH. No environment variables whatsoever are necessary.

Cheers,
John E. / TDM
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)