Community
Participate
Working Groups
Build Identifier: M20110909-1335 In a standard C/C++ project (for instance: the basic hello world project), if you remove a C file from a source folder. Internal builder Linker will try to link object file corresponding to the removed file. The test has been done with CDT 7.0 and CDT 8.0 and it is the same. It seems that removedCalcVisit() in BuildDescriptor.java adds the removed C/C++ file to list of files to compile. The only solution is to clean project and compile everything once again. (waste of time with hundreds of C files). Reproducible: Always Steps to Reproduce: 1.Create a Hello World C++ Project. 2.Build project (exe is geenrated). 3.Copy/Past the C file to create a copy with a different name. 4.Delete the original C file. 5.try to build again -> Linker fails with message: **** Internal Builder is used for build **** g++ -O0 -g3 -Wall -c -fmessage-length=0 -o src\Copy of <orignal>.o ..\src\Copy of <orignal>.cpp g++ -o visual.exe src\Copy of <orignal>.o src\<orignal>.o src\<orignal>.o: In function `main': <orignal>.cpp:12: multiple definition of `main' src\Copy of <orignal>.o: /Copy of <orignal>.cpp:12: first defined here collect2: ld returned 1 exit status Build error occurred, build is stopped Time consumed: 1070 ms.
I am unable to reproduce this on master. My Build output is: 16:39:47 **** Incremental Build of configuration Debug for project test366039 **** make all Building file: ../src/test366039_2.c Invoking: Cygwin C Compiler gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test366039_2.d" -MT"src/test366039_2.d" -o "src/test366039_2.o" "../src/test366039_2.c" cygwin warning: MS-DOS style path detected: C:\eclipse-SDK-4.2-win32\eclipse\runtime-New_configuration\test366039\Debug Preferred POSIX equivalent is: /cygdrive/c/eclipse-SDK-4.2-win32/eclipse/runtime-New_configuration/test366039/Debug CYGWIN environment variable option "nodosfilewarning" turns off this warning. Consult the user's guide for more details about POSIX paths: http://cygwin.com/cygwin-ug-net/using.html#using-pathnames Finished building: ../src/test366039_2.c Building target: test366039.exe Invoking: Cygwin C Linker gcc -o "test366039.exe" ./src/test366039_2.o Finished building target: test366039.exe
NOTE: This bug is observed with the CDT "Internal Builder" only. The reported issue is due to incorrect handling of BuildStep objects by the RebuildStateSynchronizer in the case where the number of input resources has decreased since the previous build but remains greater than zero. There is a related issue that the obsolete input resources (eg object files) are not removed from the project. Patch to follow.
New Gerrit change created: https://git.eclipse.org/r/58908
This patch updates the set of input resources associated with a build step when the RebuildStateSynchronizer has determined that an input resource has been removed. It also deletes the underlying file resource to avoid cluttering the project with obsolete generated files. The resulting behaviour of the "Internal Builder" mirrors that of the "External Builder" on the first build following a source file deletion. Without this patch, object code may remain in the build artifact after the originating source file has been deleted and the project built.
Gerrit change https://git.eclipse.org/r/58908 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=e62e2772fe26628dbdc0cf86675983f7c399e7aa
New Gerrit change created: https://git.eclipse.org/r/62635
Gerrit change https://git.eclipse.org/r/62635 was merged to [cdt_8_8]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=e37153ae8c4c43cd54d657cc2e8ea3ccb18548a2