Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Long argument list
Long argument list [message #902662] Sun, 19 August 2012 04:09 Go to next message
db666 san is currently offline db666 san
Messages: 3
Registered: August 2012
Junior Member
Hi folks,

I'm currently building a 800+ file "shared library" project in CDT using MingW and am hitting a weird behaviour for which I don't have an answer. The current scenario is:

1) I have set up CDT using MingW toolchain
2) I had to manipulate the path variable so that it finds all the executables
3) After doing all the necessary adjustments, I'm finally able to build the "object" files for the C++ files of my project.
4) *But* the catch is that whenever CDT tries to "link" all those object files in a DLL, I think I'm hitting a "long argument list" error which CDT shows as "g++: CreateProcess: No such file or directory" in the console window. I guess this because all those object files are part of the command which results in a 32K long command. I thought CDT would transparently handle this but for some reason it doesn't.
5) I'm able to build the same project successfully in Visual Studio and visual studio is emitting pretty much the same command.

So my question: is it possible to make CDT behave the same way Visual Studio does and make it handle the "long" argument list properly?

TIA,
sasuke

[Updated on: Sun, 19 August 2012 04:10]

Report message to a moderator

Re: Long argument list [message #902663 is a reply to message #902662] Sun, 19 August 2012 04:44 Go to previous messageGo to next message
Klaus Mr is currently offline Klaus Mr
Messages: 107
Registered: November 2011
Senior Member
Maybe you make an error in step 2 , setting the compiler and environment paths. Check it carefully and try the Hello Worlds C++ example, which comes with CDT.

Search this error message on stackoverflow, you will find some discussion about the error message. For example:

http://stackoverflow.com/questions/5847442/eclipse-cdt-error-unable-to-compile

Windows only supports 8K long command lines, so it would not be possible to have 32K long command lines (also not in Visual C):

http://support.microsoft.com/kb/830473/EN-US

Typically one writes such long parameter list into an "options file" and than put this options file on the command line. But I'm not sure, if this is possible in your case.

But i guess the problem is in step 2 ....

regards
Klaus


Re: Long argument list [message #902664 is a reply to message #902663] Sun, 19 August 2012 05:24 Go to previous messageGo to next message
db666 san is currently offline db666 san
Messages: 3
Registered: August 2012
Junior Member
Thanks for the reply but I guess it is clarification time for me.

Quote:
Maybe you make an error in step 2 , setting the compiler and environment paths. Check it carefully and try the Hello Worlds C++ example, which comes with CDT.

I made a sample "shared library" project "test-1" which has a simple Person class and used it in other executable project "test-2" which uses that Person class. This example works fine so I'm pretty sure there is no problem on the configuration front.

Quote:
Windows only supports 8K long command lines, so it would not be possible to have 32K long command lines (also not in Visual C):

Yes, I know that. It's just that I find it a bit strange that Visual Studio is for some reason able to execute that long command while CDT can't. I can confirm this is a problem with CDT because both "g++" (mingw) and "lib.exe" (Visual Studio) barf out when running really long command on the command line. It's just that Visual Studio is doing *something* which causes it not to throw error and build the shared library correctly whereas that fails in CDT. For reference, here are the commands:

// Visual Studio
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\Lib.exe /OUT:".\something.dll" /LIBPATH:C:\boost\boost_1_47\lib /NOLOGO .\build\vc100\Win32\Release\a.obj
         .\build\vc100\Win32\Release\b.obj
         100's of other obj files
         .\build\vc100\Win32\Release\zzz.obj

// CDT
g++ -Wl,--add-stdcall-alias -shared -o something.dll "a.o" "b.o" ... and 100s of .o files


Quote:
Typically one writes such long parameter list into an "options file" and than put this options file on the command line. But I'm not sure, if this is possible in your case.

Ideally I shouldn't have to mess with anything when using CDT but I still tried that and it fails with the same error. I used the @file argument of g++.
Re: Long argument list [message #902665 is a reply to message #902662] Sun, 19 August 2012 06:00 Go to previous messageGo to next message
Klaus Mr is currently offline Klaus Mr
Messages: 107
Registered: November 2011
Senior Member
Hello,

i found this bug entry (open since 2004!):

https://bugs.eclipse.org/bugs/show_bug.cgi?id=72965

So my suggestion is to switch from managed build to a makefile project and write your own makefile to solve the problem.

Or fix the problem in CDT by providing a CDT patch Smile

regards
Klaus
Re: Long argument list [message #902682 is a reply to message #902665] Sun, 19 August 2012 09:40 Go to previous message
db666 san is currently offline db666 san
Messages: 3
Registered: August 2012
Junior Member
That's really unfortunate. Eclipse CDT looked like real good drop-in replacement for Visual Studio and I was hoping to start using it on Windows. But looks like it's not prime time yet given that it can't be used on real projects (i.e. lots of files) given its current limitations on Windows (always re-build when using parallel build, too long argument error etc.).

Thanks for your help Klaus, much appreciated. Smile
Previous Topic:Indexer workaround for partial includes
Next Topic:Extract C method name from a Java Code
Goto Forum:
  


Current Time: Mon Jul 28 00:22:19 EDT 2014

Powered by FUDForum. Page generated in 0.04620 seconds