简体   繁体   English

如何在Eclipse中链接大型C ++-Project

[英]How to link large C++-Project in Eclipse

I am currently working on a very large C++-Project in my company. 我目前在公司中从事一个非常大的C ++项目。 My job is to build a code generator for certain parts of the project. 我的工作是为项目的某些部分构建代码生成器。 The Project is managed in Kinetis Design Studio 3.0.0 which is based on Eclipse. 该项目在基于Eclipse的Kinetis Design Studio 3.0.0中进行管理。 The Compiler used is GNU ARM C/C++ Cross Compiler 1.12.1 使用的编译器是GNU ARM C / C ++交叉编译器1.12.1

Now my problem is: As the number of files my generator created increased, suddenly an error message appeared: 现在我的问题是:随着生成器创建的文件数量增加,突然出现错误消息:

arm-none-eabi-g++: error: ./00_Hmi/FontsHandler/SEGE_UI_11B.o: No such file or directory
make: *** [CDSB_AutoGen.elf] Error 1

The message pops up when the linker tries to link all the object files to the final binary. 当链接器尝试将所有目标文件链接到最终二进制文件时,将弹出该消息。 The file that is not found by the linker does definitely exist. 链接器找不到的文件确实存在。 If I exclude some files from the build the error disappears (obviously I have to fix some includes and parts of the code that depend on those files). 如果我从构建中排除某些文件,错误消失(显然,我必须修复依赖于那些文件的某些包含和部分代码)。 It doesn't seem to matter which files I exclude. 我排除哪些文件似乎无关紧要。 I can include all the generated files and just exclude some others. 我可以包括所有生成的文件,而排除其他一些文件。 I found here that linkers have a maximum number of object files that can be passed in the command line. 我在这里发现链接器具有可以在命令行中传递的最大目标文件数。 I couldn't find that limit for GCC C++-Linker but I believe this could be the problem. 我找不到GCC C ++-Linker的限制,但我相信这可能是问题所在。 The compiler creates around 160 Object files but I am not sure if all of them are used in that final link stage. 编译器创建了约160个目标文件,但是我不确定在最终链接阶段是否全部使用了它们。 I am not an expert with make or with how Eclipse handles these things. 我不是make或Eclipse如何处理这些事情的专家。 But IF my guess is correct: Is there any way to tell the linker to use all the Object files? 但是,如果我的猜测是正确的:有什么办法告诉链接器使用所有Object文件吗?

EDIT: I renamed the folder that contains most of the files. 编辑:我重命名了包含大多数文件的文件夹。 The linker command got way shorter and now it works fine. 链接器命令变得更短,现在可以正常工作了。 I may have to either use shorter filenames or pack some of the .cpp files together. 我可能必须使用较短的文件名或将某些.cpp文件打包在一起。

You can also reorganise your project structure and chop sources into a bunch of static libraries linked together at the end of the building process. 您还可以在构建过程结束时将项目结构重组,并将源砍成一堆链接在一起的静态库。 This will help to reduce the size of final linkage command. 这将有助于减小最终链接命令的大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 设置包含c / c ++的路径 - 相对于Visual Studio代码中的工作空间路径的项目(.json配置) - Set include paths of c/c++-project relative to workspace path in Visual Studio Code (.json configuration) 将外部C库加载到现有的C ++项目中(fe ffmpeg / libavcodec-逐步介绍) - Load an extern C-library into an existing C++-Project (f.e. ffmpeg/libavcodec - step by step) 尝试在Linux Mint 17.1 64bit上“制作” C ++项目时,来自cstdlib的错误以及类似错误(未声明/不是类型) - Compile Errors from cstdlib and similar when trying to “make” C++-project on Linux Mint 17.1 64bit (not declared/not a type) 如何在Eclipse中将C项目与C ++静态库(使用opencv)链接 - How to link a C project with a C++ static library(using opencv) in eclipse 从Netbeans迁移到大型C ++项目的Eclipse - Migrations from Netbeans to eclipse for large C++ project 如何在C项目中链接C ++库 - How to link a C++ library in a C project 如何在Visual Studio中组织C ++大项目 - How to organize a C ++ large project in Visual Studio 如何在Eclipse中设置linux C ++项目? - How to setup a linux C++ project in Eclipse? 如何将C makefile项目导入eclipse或放入eclipse下 - How to import C makefile project into eclipse or put in under eclipse 如何用Eclipse打开现有的C ++项目? - How to open existing C++ project with Eclipse?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM