Jump to content
Sign in to follow this  
chuckj

Unable To Compile Non-project Dir Sources In Mplab

Recommended Posts

Running BoostC ver 6.95 on MPLAB ver 8.3.

 

I am compiling in MPLab using an MPLab project.

 

If the C file is in the same directory as the workspace or project file, it compiles fine in BoostC.

If the C source file is in a subdirectory of the workspace directory, the BoostC command line shows an attempt to compile the file as if it were in the workspace directory. This gives an "unable to open input file ...." error.

 

If I double click on the file within MPLab .mcw window, the file comes up in the editor just fine.

 

This issue is identical to the issue in Bongo's forum post of March 31st, except I am running ver 6.95.

I did not see any resolution in that post, so I did a new post rather than post to that thread.

 

Is there something I can do within MPLab to make this work - aside from putting all of my sources in the workspace dir???

 

Thanks.

Share this post


Link to post
Share on other sites
Running BoostC ver 6.95 on MPLAB ver 8.3.

 

I am compiling in MPLab using an MPLab project.

 

If the C file is in the same directory as the workspace or project file, it compiles fine in BoostC.

If the C source file is in a subdirectory of the workspace directory, the BoostC command line shows an attempt to compile the file as if it were in the workspace directory. This gives an "unable to open input file ...." error.

 

If I double click on the file within MPLab .mcw window, the file comes up in the editor just fine.

 

This issue is identical to the issue in Bongo's forum post of March 31st, except I am running ver 6.95.

I did not see any resolution in that post, so I did a new post rather than post to that thread.

 

Is there something I can do within MPLab to make this work - aside from putting all of my sources in the workspace dir???

 

Thanks.

 

Hi chuckj

 

I have had the same problem so I wrote some VBScript to copy any project source .c and .h files to the project root directory...

 

copyfile.vbs

Dim fs, currentFolder, files, aFile

Set fs = CreateObject("Scripting.FileSystemObject")

curDir = fs.GetAbsolutePathName(".")

Set folder = fs.GetFolder(curDir)

For Each item in folder.SubFolders
Set currentFolder = fs.GetFolder(item.path)
Set files = currentFolder.Files
For Each aFile in files
	If fs.GetExtensionName(aFile) = "c" Or fs.GetExtensionName(aFile) = "h"  Then
		fs.CopyFile aFile, curDir & "\"
	End If
Next
Next

Set folder  = Nothing
Set fs	  = Nothing

 

I use a batch file to run this script from the Pre-Build Step in the Custom Options of the project (I use MPLAB).

 

copyall.bat

cd "<your project directory>"
cscript //Nologo copyfiles.vbs

 

This then copies all the source files in the sub-directories of the project directory into the project directory prior to compilation.

 

Its a bit kludgy but it gets round the problem of keeping the project source in separate directories.

 

Hope this helps.

 

Regards, Mike.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...