News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

GetBuildTarget??

Started by deadneurons, October 18, 2007, 02:46:44 PM

Previous topic - Next topic

deadneurons

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:


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?



Biplab

Quote from: deadneurons on October 18, 2007, 02:46:44 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-
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.

deadneurons

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.