【发布时间】:2015-10-13 19:45:38
【问题描述】:
我有一个 Eclipse 管理的 make c++ 项目,其中源代码位于多个子目录中,其中一个目录名为“test”。 Eclipse 会自动为每个子目录 (Debug/test/subdir.mk) 创建 makefile,并且该部分运行良好。
但是,如果我在项目属性中更改编译器(比如 icpc 而不是 gcc),主 makefile(Debug/makefile)会更改为使用新编译器,但 subdir.mk 不会更改。 subdir.mk 仍然有 gcc,而 Debug/makefile 有 icpc 作为编译器命令。我尝试为每个子目录设置属性,但我仍然遇到同样的问题。
我正在使用 Eclipse Mars
有什么办法可以改变吗?
这是调试/makefile ################################################# ############################## # 自动生成的文件。不要编辑! ################################################# ##############################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include test/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: TestProject
# Tool invocations
TestProject: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
icpc -L<LinkerStuff> -lrt -openmp -inline-forceinline -o "TestProject" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(CC_DEPS)$(C++_DEPS)$(EXECUTABLES)$(C_UPPER_DEPS)$(CXX_DEPS)$(OBJS)$(CPP_DEPS)$(C_DEPS) TestProject
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
这里是Debug/test/subdir.mk
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../test/TestProject.cpp
OBJS += \
./test/TestProject.o
CPP_DEPS += \
./test/TestProject.d
# Each subdirectory must supply rules for building sources it contributes
test/TestProject.o: ../test/TestProject.cpp
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
icc-I<includes stuff> -O3 -g3 -Wall -c -fmessage-length=0 -openmp -MMD -MP -MF"$(@:%.o=%.d)" -MT"test/TestProject.d" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
【问题讨论】:
-
我试图回答这个问题,但是在您的 Debug/test/subdir.mk 中,无论如何该命令看起来都是错误的。
icc-I...有三个问题1.不是gcc,2.不是ipcc 3.-I前面没有空格。我认为这是一个编辑问题,并且已经回答了这个问题,就好像它说gcc -I... -
你是对的,我试图改变一些东西,但一次尝试我让 subdir.mk 文件有“icc”而不是“gcc”,但仍然没有“icpc”。这是在我更改了编译器和链接器设置之后
-
不确定我是否关注。如果您在设置中输入
icpc并且icc出现在makefile 中,这听起来像是一个错误。如果您有可重现的测试用例,我相信欢迎提交错误报告bugs.eclipse.org/bugs/enter_bug.cgi?product=CDT
标签: eclipse eclipse-cdt eclipse-mars