简体   繁体   中英

Code::Blocks with MinGW linking fail

I am using Code::Blocks (ver. 13.12) with MinGW (ver. 4.7.1) on 32-bit Windows 7.

While trying to build my project I get the following error after the compilation step:

Execution of 'mingw32-g++.exe  -o cb_dlv.exe
...huge list of *.o files...
in 'D:\Workspace\cb_dlv' failed.

There's certainly no problem with toolchain executables as my other projects compile and link pretty well and all the tools are in their right places. mingw32-g++.exe is seen from cmd so no problems with PATH variable. Cleaning workspace also doesn't seem to help in any way. I've already tried to move project files so that the path has no spaces in it, but it didn't help either. As well as reopening/reinstalling/rebooting.

Any suggestions?

Since I've found the solution, here it is.

The main problem was that on Windows 7, the limit for the length of a command line is around 32K characters. MinGW compiler and linker hit that limit while building projects with huge amount of files in them. This is a fundamental limitation of Windows APIs that MinGW uses.

The solution: shorten the command line in any way you like: merge some files in one, separate project into several ones, rename subdirectories with long names, etc.

Have you set your project to use a custom makefile? What are your build system variables? Are the object files available in D:\\Workspace\\cb_dlv? Is that the only output of your compile log or is there other output before it? are your project's build targets set up sensibly?

you should see the build system log that it is compiling your c/c++ files to object files before the last linking stage happens ie stuff like:

mingw32-g++.exe -c D:\Workspace\cb_dlv\file.c -o D:\Workspace\cb_dlv\obj\Debug\file.o

Please flesh out this question some more and I might be able to help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM