Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: lpcstr on February 01, 2011, 09:06:22 am

Title: Linking error: crtbegin.o not found
Post by: lpcstr 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.  :(
Title: Re: Linking error: crtbegin.o not found
Post by: lpcstr 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?
Title: Re: Linking error: crtbegin.o not found
Post by: oBFusCATed on February 01, 2011, 09:27:18 am
Your compiler installation is broken probably...
Title: Re: Linking error: crtbegin.o not found
Post by: MortenMacFly 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.
Title: Re: Linking error: crtbegin.o not found
Post by: Jenna 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.
Title: Re: Linking error: crtbegin.o not found
Post by: MortenMacFly 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...?!
Title: Re: Linking error: crtbegin.o not found
Post by: Jenna 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.
Title: Re: Linking error: crtbegin.o not found
Post by: MortenMacFly 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:
Title: Re: Linking error: crtbegin.o not found
Post by: lpcstr 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.
Title: Re: Linking error: crtbegin.o not found
Post by: MortenMacFly 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.