Eclipse/Neon.2 ignoring a source file - c

I'm working with a CDT project in Eclipse/Neon.2 which cross compiles for an embedded target. I've added a bunch of .c files to the project and they are automatically included in the build except for (seemingly) one. In the project directory it is
STM32F7explore/Utilities/Log/lcd_log.c where STM32F7explore is the Eclipse project directory. If I try to build it manually, the Console window shows:
09:45:52 **** Building Selected Files of configuration Debug for project STM32F7explore ****
Info: Internal Builder is used for build
09:45:52 Build Finished (took 1ms)
For files that are included, the Console shows e.g.
09:54:50 **** Building Selected Files of configuration Debug for project STM32F7explore ****
Info: Internal Builder is used for build
arm-none-eabi-gcc -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F746xx -DLWIP_TIMEVAL_PRIVATE=0 -I../Inc -I../Drivers/STM32F7xx_HAL_Driver/Inc -I../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F7xx/Include -I../Drivers/CMSIS/Include -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -I../Middlewares/Third_Party/LwIP/src/include -I../Middlewares/Third_Party/LwIP/system -I../Middlewares/Third_Party/LwIP/src/include/lwip -I../Middlewares/Third_Party/LwIP/src/include/lwip/apps -I../Middlewares/Third_Party/LwIP/src/include/lwip/priv -I../Middlewares/Third_Party/LwIP/src/include/lwip/prot -I../Middlewares/Third_Party/LwIP/src/include/netif -I../Middlewares/Third_Party/LwIP/src/include/netif/ppp -I../Middlewares/Third_Party/LwIP/src/include/netif/ppp/polarssl -I../Middlewares/Third_Party/LwIP/src/include/posix -I../Middlewares/Third_Party/LwIP/src/include/posix/sys -I../Middlewares/Third_Party/LwIP/system/arch -I../Drivers/BSP/STM32746G_Discovery -I../Utilities/Log -O0 -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -o Src/main.o ../Src/main.c
09:54:51 Build Finished (took 224ms)
I'm baffled by why Eclipse doesn't add the lcd_log.c file to the build. I've looked at the file properties popup and they look the same for both (and in particular, Eclipse does recognize lcd_log.c as File (C Source File)
I've deleted .metadata/.plugins/org.eclipse.core.runtime/.settings from the workspace and .settings from the project to force Eclipse to regenerate these and that did not fix the problem.
The project is on Github (https://github.com/HankB/STM32F7explore) but the requirements to build are a bit steep unless you happen to be developing for ST embedded processors.
Thanks!

What is going on here is the Log (or its parent Utilities) directory is not part of the source of your project, but rather extra files in the project that are excluded.
There are some visual clues in the project explorer. Compare the two boxes in red below:
As you can see the Src and dma2d.c files use different icons than Log and lcd_log.c.
You can re-enable the folder, or individual files, by right-clicking -> Resource Configurations -> Exclude From Build... and unchecking Debug and Release in the pop-up that looks like this:
You can also control what is included by selecting project properties -> C/C++ General -> Paths and Symbols -> Source Locations tab.
What I would recommend is that rather than having Drivers, Inc, etc be explicitly included, that you include all files in your project starting at the root. To do that, select all the existing entries in Source Locations and press Delete. You should then have just one automatically re-created entry /STM32F7Explore, like this: (Remember to do the same change to both Debug and Release)
Then, if you actually do want to exclude files/folders, repeat the above steps with Resource Configurations. CDT will be be quite helpful here, if you have individual files/folders under a source directory excluded from the build you will get yet another icon. Here I have excluded a single C file (log_lcd.c) and the Fonts directory:
Some of the specific help for Eclipse CDT that relates to the above:
Icon overlays appear at the bottom of the C/C++ Projects View help
Source locations tab help

Related

Eclipse: I can run a program but I couldn't debug it

I have downloaded the well-known linuxptp source code (C language) from:
git clone git://git.code.sf.net/p/linuxptp/code linuxptp
It is a makeFile project which I could successfully run from command line, however the problem appears when I try to import it to Eclipse:
File > New > Makefile project with existing code
I can successfully build it and run it but I couldn't debug or force it to stop at a break point. I keep getting the message (No source available for "main() at 0x401eb5").
I tried to reinstall Eclipse IDE for C/C++ Developers from the official website but it didn't work.
I think it is useful to mention that:
- the source code I'm using contains different files with main() function
- Eclipse debugger runs successfully on projects created on Eclipse from scratches
Any ideas?
thanks.
You should create some debugging launch configurations for your different executables in the project.
Also be sure that the Makefiles include -g option when compiling to produce the required debugging information.
Edit:
Add this lines to your Makefiles:
CFLAGS += -g
CXXFLAGS += -g

header files not found, Eclipse

Using eclipse and I am imported an already existing project. Some header files that it is using are located outside the project so it is not able to find them. So I imported the folder (file->import->general->filesystem) where the file is located.
After compiling again, it is still complaining about not finding the header files, so I thought maybe there was a path problem for the compiler. Went to project->properties->c/c++ general->path and symbols, and added the path under the include tab for both the GNU C and GNU C++ entry. That did not solve the issue.
I have noticed the new path I added (host/common/include) does not show up in the gcc command.
Am I not adding it in the right place?
nios2-elf-gcc -xc -MP -MMD -c -I-I -Isrc -I-I -I../../../../../../../fpga_common/include -I-I -I../../../../../../../host/libraries/libbladeRF/include -I../bladeRF_nios_bsp//HAL/inc -I../bladeRF_nios_bsp/ -I../bladeRF_nios_bsp//drivers/inc -pipe -D__hal__ -DALT_NO_C_PLUS_PLUS -DALT_NO_CLEAN_EXIT -D'exit(a)=_exit(a)' -DALT_NO_EXIT -DALT_USE_DIRECT_DRIVERS -DALT_NO_INSTRUCTION_EMULATION -DALT_USE_SMALL_DRIVERS -DSMALL_C_LIB -DALT_SINGLE_THREADED -Os -g -Wall -Wextra -Wno-unused-parameter -DBLADERF_NIOS_BUILD -mno-hw-div -mno-hw-mul -mno-hw-mulx -o obj/default/common/src/conversions.o common/src/conversions.c
Any ideas what can be wrong? Or what I have done wrong?
Here's a screen shot of the project window.
Example, Convertion.c includes convertion.h
Files in project window
Solution to problem 1.
There was a make file in the project directory that I needed to add the path to.
Now the problem is it can't find windows.h and intrin.h. Not sure how to fix that yet.
You need to install some depenncies to have the missing headers files:
For windows.h:
In my computer is located at:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
It is installed alongside with Visual Studio 2013, so you'll probably need to download some Windows SDK for Windows from Microsoft:
https://developer.microsoft.com/en-us/windows/downloads/windows-8-1-sdk
For intrin.h:
Once again you'll need some external header files:
MinGW has intrin.h but it is called x86intrin.h, so you'll need to replace the header call. See the source with the same problem with you: How to cope with "intrin.h: No such file or directory"?

Eclipse CDT doesn't use my Makefile when I try to build.

I have some source code with a Makefile that builds just fine from the command line.
I followed the eclipse CDT instructions for importing a project with existing sources.
I opened the make file, and saw all the makefile targets in the Outline view.
I right clicked on one, and added it to the "Make Target" tab.
I double clicked it, and the console said it couldn't find that target:
14:24:13 **** Build of configuration Debug for project xxxxxxxxxx ****
make build-modules
make: *** No rule to make target `build-modules'. Stop.
Go back to the command line and type "make build-modules" and it works fine.
There are no other makefiles in this project. I do not know why this is failing like this.
1) Create a new project in Eclipse.
2) Import just the files that you already have.
3) Click build and make sure that you have clicked inside an open file of the project, that is open in the editor view.
User had to do also:
"Import project from Makefile" and that got my targets working.

Code::Blocks, glut, and OpenGL

I am trying to update an old C language 2-D game named Boomtown (an arcade-style Bomberman knockoff!) that uses glut and OpenGL and no longer compiles with the latest version of Code::Blocks. I am trying to add the source files into the src/ folder of the project itself but I'm getting a crash. Any help is much appreciated! I'll try to include as much info about the project as I can.
Project layout:
Name of project folder: boomtown
Located inside boomtown\src:
boomtown.cbp
include\
lib\
old version of glut32.lib (Not sure exactly how this was used in the old setup)
Other info
OS: Windows 7 64-bit (but trying to set the project up using the x86 glut resources)
CodeBlocks Version: 12.11
Compiler: GNU GCC Compiler
Here is what I have done so far:
[Glut]
Downloaded glut32.dll glut.h and glut32.lib
Added glut32.dll and glut.h into the boomtown\src\include folder
Added glut32.lib into the boomtown\src\lib folder
Replaced old glut32.lib with new (Just in case)
[OpenGL]
Added SFML source into the boomtown\src\include folder
Added SFML library files into the boomtown\src\lib folder
[CodeBlocks]
Project->Build Options->Linker settings->Link libraries: lib\glut32.lib and all SFML.a files there
Project->Build Options->Linker settings->Search directories->Compiler/Linker: \boomtown\src\
Added boomtown\src\include\glut.h to Project workspace
Added boomtown\src\include\SFML header files into Project workspace
When I build and run I get no errors (woohoo!), but a blank debug window comes up and I get this:
boomtown.exe - Application Error
The application was unable to start correctly (0xc0000be). Click OK to close the application.
If everything works correctly, the game should pop up rather than the Application Error. Any help is appreciated!
YOu have to make sure that your libraries are linked in the proper order:
The correct order is:
-lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32
Of course -lwinmm and -lgdi32 may not be required. glut32 requires glu32 which in-turn requires opengl32
Try setting your Project->Build Options->Linker settings->Link libraries: to
lib\glut32.lib lib\glu32.lib lib\opengl32.lib
etc...

Using custom Makefile with Eclipse/CDT [duplicate]

This question already has answers here:
How to use external makefile in Eclipse
(3 answers)
Closed 5 years ago.
I have a project of multiple .c and .h files and I write my own makefile.
How can I configure Eclipse to use my makefile and my source files from their original locations?
You can create a custom Makefile and make sure it's in your project root. Then you need to disable the auto generated makefiles. You can do that by going here:
Project Properties (right click on project and select properties) -> C/C++ Build -> in that window uncheck "Generate Makefiles Automatically."
To use your own targets you can open the View called "Make Target":
Window -> Show View -> Make Target
In that view you can create a new target that will use the corresponding target in your custom Makefile.
There is an option to create a project from existing makefiles: use the "Project Wizard" and select "Makefile project".
You can disable "Generate makefiles automatically" in eclipse project properties -> c/c++ build (builder settings.)
In my latest attempt to compile a Cross ARM compile, I made a painful discovery on how to get this working.
First I created a "Makefile project with existing Code". I selected the Cross ARM tool chain. If I now open a console within Eclipse and make, it works.
Now to build within the GUI, I had to:
Change properties to Internal Builder, with Generate Makefile
checked.
The settings option now offers Build Artifact tab. pick executable with ${Project}.
Build. This will result in error in link stage.
Switch the settings to External Builder, uncheck "Automatic Makefile generation"
Clean
Build
All that you have to do is tell gmake to use your makefile. The default command for Code Composer Studio is ${CCS_UTILS_DIR}/bin/gmake. Simply tell gmake to use your own makefile (e.g. sri.mk). We do this with the -f option. So the default command would become ${CCS_UTILS_DIR}/bin/gmake -f ../sri.mk
Note that Code Composer Studio is Eclipse based.
Here are the instructions:
project->properties->C/C++ Build
click on the 'Builder' tab
Un-select 'Use default build command"
Change the command to ${CCS_UTILS_DIR}/bin/gmake -f ../sri.mk
Note that the build is kicked off from the Debug directory. The Debug directory contains the makefiles that are generated by Eclipse. I put my makefile in the top level directory of the project so that's why I put ../ in -f ../sri.mk.
Also, there might be a line that says "default: esh $(PLUGIN_SO)," or something along those lines depending on your project. I've found that changing the "default" to "all" will enable the project to compile too. This is a handy feature, eclipse :)

Resources