including source files in a project [message #1753901] |
Sun, 12 February 2017 00:23 |
Eric Von Hoene Messages: 4 Registered: February 2017 |
Junior Member |
|
|
ok, I feel kinda ridiculous asking this question, but I must be missing something really simple --
I'm writing a C program in Eclipse (for an STM32 application). I started with a canned "hello world" program that works great. Step 2 was to modify it to use a new peripheral, that requires new functions, defined in other library files.
I think all of the library files are in the project workspace. The new source files I need are in the same directory as others used in the original program. But when I try to build my project, it can't find the functions, failing with "undefined reference" errors. The header files seem to be included ok -- the source compilation succeeds. It's the link that's failing.
The new library source files are shown in the Project Explorer tree, and I can open them, but the names are greyed-out and there is a slash through the icon next to them.
Can some charitable soul please tell me what obvious thing I'm overlooking?
With lots of files in the project include directories, how does Eclipse know which ones to include in the build, and which ones to ignore?
thanks!
-Eric
|
|
|
|
|
Re: including source files in a project [message #1754030 is a reply to message #1754020] |
Tue, 14 February 2017 02:23 |
Eric Von Hoene Messages: 4 Registered: February 2017 |
Junior Member |
|
|
ok, thanks for the reply!
And I apologize for sounding vague -- Eclipse is (obviously) a new environment for me, so I'm not sure even how to ask the question properly. I'm used to Microchip's IDE, and everything there is neatly integrated. Just installing all of the accessories to the Eclipse environment to be able to code, compile, download, and debug was a bit bewildering!
So, some clarification (I hope) -- I'm not trying to link to a compiled library. I have a library of source code, .c and .h files. The sample program successfully pulls in the necessary library files to build the application. My changes use functions in other files in the same directory, but for some reason they're not getting compiled and linked in. I have added the .h files to my code that uses the new functions, and that all compiles fine. But since the additional library .c files weren't compiled, the link fails.
Specifically, I'm developing for an ST Nucleo board, STM32F303RE, using the GNU ARM Eclipse distribution, the Cross ARM GCC toolchain, and the "Blinky (blink a led)" sample program with the stm32f30x standard peripheral library. The file stm32f30x_gpio.c compiles just fine; but the file stm32f30x_adc.c (which is in the same directory) is shown as not in the project (it's greyed out in the Project Explorer pane).
How do I get the environment to know that I need it to include the _adc.c file as well? I can't believe I'm stuck on what must be such a simple thing....
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09209 seconds