Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Linked C file not compiling

Altera_Forum
Honored Contributor II
1,135 Views

I have a project with several linked C files from other directories. I am getting a linker error like "file.o" not found. When I watch the compile, I see that "file.c" was never compiled even though the linker attempts to link it. All my other linked files in very simliar directories compile and link fine. Does anybody know what could be happening here? The files are all on the same drive in nearby folders to eachother. 

 

An extra bit of info: the linked file that is not compiling is residing in another project directory with all those related files and a separate makefile, while the ones that are working are just in a directory with c and h files. 

 

Update 2: I found why this is happening, and it may indicate an Eclipse/Altera setup bug. Here's the basic structure 

 

other_project_directory 

__file1.c 

__obj 

____file1.o 

source_directory 

__file2.c 

current_project_directory 

__link->file1.c 

__link->file2.c 

__obj 

_____file2.o 

 

So notice that the "other_project_directory" from which I'm linking a source file has its own obj directory. Since I had previously built that project, it had created a file1.o file in that obj directory. I think that what is happening is that the Makefile is looking in the obj directory local to the location of the source file to see if it needs to build the file, instead of looking in current_project_directory/obj.  

 

So the tools look in other_project_directory, find the file1.c and then look in other_project_directory/obj for the file1.o. Finding it from a previous build of that project, it does not build it for current_project_directory! When the linker starts, it has all the other .o files except file1.o and a linker error occurs. I solved the problem temporarily by clearing out the other_project_directory/obj folder. Not seeing the file1.o file there, the tool builds it for current_project_directory/obj and everything is happy. This may need a fix.
0 Kudos
0 Replies
Reply