Author Topic: GetBuildTarget??  (Read 4952 times)

Offline deadneurons

  • Multiple posting newcomer
  • *
  • Posts: 39
GetBuildTarget??
« on: October 18, 2007, 02:46:44 pm »
Hi,

I'm hooked with the wizard scripting and I'm trying to understand it better with my limited programming skills.
I like the scripting because I get instant result and C::B don't disappear if I make something wrong  it just throws a warnings and tells me where to look at. I'm trying to make me a new project wizard, but having trouble with this part of the code:

Code
	startupScript = project.AddBuildTarget( _T("Startup") );
TargetIndex = project.GetBuildTarget( startupScript );
ProjectManager.AddFileToProject( _T("src\\test.c"), project , TargetIndex ) ;

I looked at the sdk files, and I found out that GetBuildTarget has two versions, one I can pass an index and get a name, the other I can pass a name and get and index. I get an error with 3rd line of above code,
TargetIndex seems not correct. What is the correct way to get the index of the targets?



Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: GetBuildTarget??
« Reply #1 on: October 18, 2007, 06:19:19 pm »
I looked at the sdk files, and I found out that GetBuildTarget has two versions, one I can pass an index and get a name, the other I can pass a name and get and index. I get an error with 3rd line of above code,

Both of them returns a ProjectBuildTarget pointer.

Change the code to-
Code
	startupScript = project.AddBuildTarget( _T("Startup") );
ProjectManager.AddFileToProject( _T("src\\test.c"), project , -1 ) ;

This should work.
Be a part of the solution, not a part of the problem.

Offline deadneurons

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: GetBuildTarget??
« Reply #2 on: October 19, 2007, 12:59:03 am »
Thanks the error disappear, but according to the doc I got "r4510.chm," I should get a prompt to select which target I wish to add the file if I have more than one target. I don't get a prompt. I'm using 4536 build.
I'm just exploring now, and just checking if certain things can be done using the script. Thanks again.