Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - linked source file is not compiled in a project: (6 Items)
   
linked source file is not compiled in a project  
On 6.4.1, the IDE on Windows XP. I created a QNX C++ project and I added a existed file into the project. And I can see 
the source file that is marked as linked  in my project. However the build does not compile the linked source file. Look
 into the common.mk, I can't see any clue that source file is included. 

Is it an expected behavior or not? 
 
Re: linked source file is not compiled in a project  
Hi, Weijie,

Yes, this is expected.  The command-line make tool knows nothing about 
linked resources, which are a fiction of the IDE's project metadata.

You need to add this source file to the project's "extra source path" 
setting (the EXTRA_SRCVPATH macro):  find this in the "QNX C/C++ 
Project" property page, on the "Compiler" tab, pull down the "Category" 
selector and choose "Extra sources paths" (sic).   Use the button to add 
directories to the source path (note that you cannot add individual 
source files).

To handle the case of individual files, you can add the object file 
compiled from a source file to the EXTRA_OBJS macro (in the project's 
Linker settings).  This would be feasible if, for example, some other 
project already builds the object file.

HTH,

Christian


On 07/09/10 02:22 PM, Weijie Zhang wrote:
> On 6.4.1, the IDE on Windows XP. I created a QNX C++ project and I added a existed file into the project. And I can 
see the source file that is marked as linked  in my project. However the build does not compile the linked source file. 
Look into the common.mk, I can't see any clue that source file is included.
>
> Is it an expected behavior or not?
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post66170
>
>    
Re: linked source file is not compiled in a project  
Thanks Christian. The problem with EXTRA_SRCVPATH is that all the cpp files there are automatically compiled in while I 
want only a few of them. In order to exclude the sources that I don't want in the path, I have to use EXCLUDE_OBJS also.
 

It is interesting that if we create a C++ project (rather than QNX C++ project as the common.mk overrides.), the "
Internal Builder" is able to compile the linked source.  

Regards,
Weijie
Re: linked source file is not compiled in a project  
Hi, Weijie,

Yes, that is because the Internal Builder for managed projects doesn't 
use an external make tool to orchestrate compilation and linking.  
Because it is implemented in the IDE, it has complete knowledge of the 
IDE's workspace structure, including linked resources.  Note that if you 
use the Gnu Make Builder, the IDE will generate makefiles that compile 
the linked source files using specific paths in the filesystem.

Maintaining EXCLUDE_OBJS is not great, no, because it is by nature an 
unbounded set.

Your source control system may provide a mechanism to share your extra 
source files with other projects (e.g., SVN externals) or your 
filesystem may help (e.g., symlinks).  You might also check out Elena's 
article discussing project set-up for additional ideas:

http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/ProjectsBuildAndIDE

For example, how to set up automated builds for managed projects if you 
want to use those instead of QNX Projects.

Cheers,

Christian

On 07/09/10 03:03 PM, Weijie Zhang wrote:
> Thanks Christian. The problem with EXTRA_SRCVPATH is that all the cpp files there are automatically compiled in while 
I want only a few of them. In order to exclude the sources that I don't want in the path, I have to use EXCLUDE_OBJS 
also.
>
> It is interesting that if we create a C++ project (rather than QNX C++ project as the common.mk overrides.), the "
Internal Builder" is able to compile the linked source.
>
> Regards,
> Weijie
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post66180
>
>    


-- 
*Christian W. Damus*
Software Developer, IDE Team
QNX Software Systems <http://www.qnx.com/>;
Re: linked source file is not compiled in a project  
Good suggestions and I'll check Elena's link also. Thanks Christian. 

Regards,
Weijie
Re: linked source file is not compiled in a project  
If you have a directory with sources partially compiled, you may want to
ask yourself if you can split that directory into multiple ones, and
only add the one required by the compile to the EXTRA_SRCVPATH. This
also allows you to share sources to multiple projects.


-----Original Message-----
From: Weijie Zhang <community-noreply@qnx.com>
Reply-to: post66180@community.qnx.com
To: general-ide <post66180@community.qnx.com>
Subject: Re: linked source file is not compiled in a project
Date: Tue, 7 Sep 2010 15:03:32 -0400 (EDT)

Thanks Christian. The problem with EXTRA_SRCVPATH is that all the cpp files there are automatically compiled in while I 
want only a few of them. In order to exclude the sources that I don't want in the path, I have to use EXCLUDE_OBJS also.
 

It is interesting that if we create a C++ project (rather than QNX C++ project as the common.mk overrides.), the "
Internal Builder" is able to compile the linked source.  

Regards,
Weijie