简体   繁体   中英

Problems with adding Icon to executable (Eclipse CDT Luna): make: *** No rule to make target 'resources.o'

I am following this and this to add an Icon to my Executable

I am getting Error

make: *** No rule to make target 'resources.o', needed by 'Project_Name'.  Stop.

I have:
- created resources.h
- created resources.rc (Already checked that path inside file is correct)
- added #include "resources.h" to my main.cpp
- added prebuilt option

  windres ../resources.rc -O coff -o ../resources.o

- added linker object resources.o

Still looks like something is missing. The files resource.rc and resource.h are included in my project

I have managed to find the solution myself. Eclipse builds following directory structure:

project_name
- Release
- Debug
- .settings

Because gcc/g++ is called to build .o files in the Release/Debug folder, and .cpp and .h files are in project_name the same must go with .rc files - seems like I have mistaken the folders in linked explanation

I put resource.rc and .ico in project_name, and as with .cpp I am making .o files one folder below

So this is the right command in
Project->Properties->C/C++ Build->Settings->Build Steps->Pre-build->Command

windres ../resources.rc -O coff -o  ./resources.o  

and in
Project->Properties->C/C++ Build->Settings->Tool Settings->Linker->Miscellaneous->Other objects
add 'resource.o'

And most important: to avoid 'no rule to make target' none of mentioned files should be added to the project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM