Author Topic: Linking error: crtbegin.o not found  (Read 15766 times)

Offline lpcstr

  • Multiple posting newcomer
  • *
  • Posts: 11
Linking error: crtbegin.o not found
« on: February 01, 2011, 09:06:22 am »
When trying to compile a C++ program I get the following error output:

Code
ld||cannot find crtbegin.o: No such file or directory|
ld||cannot find crtend.o: No such file or directory|

I'm using Code::Blocks 10.05 and MinGW with GCC 4.5.2 on Windows 7 64-bit.

My search directories are as follows:

Linker:
Code
C:\MinGW\lib
C:\MinGW\lib\gcc\mingw32\4.5.2

and if I look inside C:\MinGW\lib\gcc\mingw32\4.5.2 it contains both files. The only way I can get anything to compile is to copy these two files into my project folder.  :(

Offline lpcstr

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Linking error: crtbegin.o not found
« Reply #1 on: February 01, 2011, 09:21:45 am »
Ok, so copying those two files to C:\MinGW\lib is a fix, if that helps anyone with the same problem. Doe anyone know where the issue lies?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Linking error: crtbegin.o not found
« Reply #2 on: February 01, 2011, 09:27:18 am »
Your compiler installation is broken probably...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Linking error: crtbegin.o not found
« Reply #3 on: February 01, 2011, 04:53:08 pm »
Your compiler installation is broken probably...
Either that or you have an older MinGW in the PATH which is used instead of the one you are referring to. Do you have any other MinGW development environment installed that might have changed the PATH?

I am asking because this was a known bug with older MinGW compilers on Vista/Win7 which is fixed in 4.5.2 fur sure.
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Linking error: crtbegin.o not found
« Reply #4 on: February 01, 2011, 04:59:09 pm »
It does not need to be in path.
Just an installation or a rest of an installation in x:\MinGW (where x is any drive) is enough as far as I know.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Linking error: crtbegin.o not found
« Reply #5 on: February 01, 2011, 05:36:56 pm »
It does not need to be in path.
Sure not, but what I meant was besides the compiler he wants to use there might be another one in parallel in the PATH that got detected and therefore be used...?!
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Linking error: crtbegin.o not found
« Reply #6 on: February 01, 2011, 05:45:33 pm »
And what I meant is, that any x:\MinGW can interfere with a MinGW installation in another place, because it was (is?) hardcoded to search there.
« Last Edit: February 01, 2011, 05:48:06 pm by jens »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Linking error: crtbegin.o not found
« Reply #7 on: February 01, 2011, 06:09:32 pm »
And what I meant is, that any x:\MinGW can interfere with a MinGW installation in another place, because it was (is?) hardcoded to search there.
Ah - sorry, I misunderstood. :oops:
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 lpcstr

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Linking error: crtbegin.o not found
« Reply #8 on: February 02, 2011, 06:04:01 am »
I've never had MinGW on this machine before. I downloaded and installed the latest version using their GUI installer for Windows, then I installed Code::Blocks. MinGW didn't add anything to the PATH variable itself so I had to add it myself so I could run gcc from cmd.exe. If my installation is defective it has to be because of a defect in their installer or an incompatibility with Vista/7.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Linking error: crtbegin.o not found
« Reply #9 on: February 02, 2011, 06:41:15 am »
it has to be because of a defect in their installer or an incompatibility with Vista/7.
To make very sure you can copy the command line from the compiler log (assuming you have full command logging enabled, see my sig) and run it at the Windows command prompt (not using Code::Blocks). Another reason might be a dumb anti-virus solution and/or firewall blocking file operations too restrictive.
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