Archived

This topic is now archived and is closed to further replies.

This topic is 5240 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

In linking a project in Dev C++ the number of object files required to link is too large and causes the command required for linking to overflow the max command length. The command that needs to execute is this: g++.exe GameEngine.o Common/winexception.o Common/image.o Common/imagecodec.o Common/log.o Common/mmpointer.o Common/object.o Common/ref.o Common/resource.o Common/timer.o Common/window.o Common/dynamicLib.o engine/aabb.o engine/abt.o engine/engine.o engine/entity.o engine/game.o engine/geometrychunk.o engine/input.o engine/mesh.o engine/meshserializer.o engine/renderable.o engine/renderqueue.o engine/scenemanager.o engine/subentity.o engine/submesh.o engine/wireboundingbox.o engine/camera.o Win32/Win32Window.o engine/skyplane.o engine/skydome.o -o "Game.exe" -L"C:/DEV-CPP/lib" -mwindows Maths/Maths.a -l dxguid -l dinput8 But this returns ''Bad Command or filename''. Removing a couple of units from the project allows it to run, but obviously doesn''t finish linking due to unresolved external references. Is there any way around this?

Share on other sites
You''ve hit the 256 char command line limit - nasty. Hopefully someone knows how to correct this, if not then you could try pre-compiling some of the files into a static library (raries) and linking them together.

Share on other sites
You probably need to make a makefile. I''m not sure, but I''m betting it can spec commands of any length.

Share on other sites
The thing is, that long command is being executed from the makefile that Dev-C++ creates.

This is kinda a hackish way to get around it, but you might be able to pick a few of those object files that could go together in a library file, which could dramatically reduce the length of the command line.

Share on other sites

I'm used to compiling off the command line with makefiles in a Linux environment. I'm trying to compile my project in windows using Dev-C++ which i am completely new to. The project compiles fine (mostly), but the linker freaks out because of the 127 char limit on the command line (grrr... stupid Windows).

Are there any ways around this? How on earth am i supposed to link all my files together if there lots of them? I can reduce the filenames i'm sure, but it still wouldn't fit into 127 chars. This is what my project-generated makefile is trying to do:

\$g++.exe ../msys/1.0/home/leiavoia/theark/src/algo/Quadtree.o ../msys/1.0/home/leiavoia/theark/src/algo/QuadtreeNode.o ../msys/1.0/home/leiavoia/theark/src/core/drawing.o ../msys/1.0/home/leiavoia/theark/src/core/GameSpace.o ../msys/1.0/home/leiavoia/theark/src/core/main.o ../msys/1.0/home/leiavoia/theark/src/fx/animation/Explosion1.o ../msys/1.0/home/leiavoia/theark/src/fx/animation/Animation.o ../msys/1.0/home/leiavoia/theark/src/fx/Particle.o ../msys/1.0/home/leiavoia/theark/src/fx/ParticleSource.o ../msys/1.0/home/leiavoia/theark/src/fx/backgrounds/BackgroundImage.o ../msys/1.0/home/leiavoia/theark/src/objects/CollisionObjects.o ../msys/1.0/home/leiavoia/theark/src/objects/LifeObject.o ../msys/1.0/home/leiavoia/theark/src/objects/PhysicalObject.o ../msys/1.0/home/leiavoia/theark/src/objects/PollingObject.o ../msys/1.0/home/leiavoia/theark/src/objects/TestCritters.o ../msys/1.0/home/leiavoia/theark/src/objects/BasicObjects.o ../msys/1.0/home/leiavoia/theark/src/utilities/LogManager.o -o "HAND.exe" -L"C:/DEV-CPP/lib" -lGL -lGLU -lSDL -lSDL_image -lmingw32 -lSDLmain

[edited by - leiavoia on May 15, 2004 8:44:54 PM]

Share on other sites
The way I got around this problem was that I coded a small program that executes a given command with the CreateProcess function of the windows API. It can handle arbitrarily long command lines. After Dev-C++ has compiled I simply run the linking command with my program. Of course it creates a bit of a hassle having to execute the linking command separately, but at least it works.

Share on other sites
do you have the source for that little program? I''d really appreciate it. I''m not the least bit familiar with Windows programming.

Share on other sites
My program is made with wxWidgets so the source has lots of irrelevant GUI stuff. Here''s the code that actually executes the given command using CreateProcess.

 bool success;std::string command;	//Put the command herestd::string path;	//This is the working directory (the directory where your Dev-C++ project is)SECURITY_ATTRIBUTES attr;attr.nLength = sizeof(SECURITY_ATTRIBUTES);attr.lpSecurityDescriptor = NULL;attr.bInheritHandle = true;STARTUPINFO si;si.cb = sizeof(STARTUPINFO);si.lpReserved = NULL;si.lpDesktop = NULL;si.lpTitle = NULL;si.cbReserved2 = 0;si.lpReserved2 = NULL;si.dwFlags = STARTF_USESTDHANDLES;si.hStdInput = in;si.hStdOutput = out;si.hStdError = err;PROCESS_INFORMATION pi;success = CreateProcess(NULL, (CHAR *) command.c_str(), &attr, &attr, true, CREATE_NEW_CONSOLE, NULL, (CHAR *)path.c_str(), &si, &pi);

1. 1
2. 2
3. 3
Rutin
21
4. 4
frob
17
5. 5

• 9
• 33
• 13
• 13
• 10
• Forum Statistics

• Total Topics
632582
• Total Posts
3007206

×