I saw in a github(https://github.com/sandym/swiftpp) project on using "cxx-Bridging-Header.h" header file for .cpp(C++) and .mm (objective-C++) file and learnt that it was build by "Run Script" but didn't got any clear idea about how to create the header. Please help on how to create such a header?
Go to, File -> new File -> iOS source -> header file .h -> click on project to bring up build settings, look for Objective-C Bridging Header double click in blank field to bring up blank view -> drag and drop your newly created .h file into blank view till the file path is there (it might disappear on you a couple of times) -> go to .h file and #import "cxx-Bridging-Header.h" build and you should be good to go.
Good luck!
When I create a new project in code blocks File->New->project->console application->Go->C++-><project title>->GNU compiler->finish (both debug and release box are checked), Then a project is created having .cpp file with name of main.
My question is how to rename this main file.
Before asking this question I have tried to solve it, but it includes many steps.
I have tried two ways (one way gives me a solution, and the other way indicates that file has been corrupted).
Actually I want to find a quick way to rename this main file?
If there is any method please tell me.
Two methods which I used(mentioning below)
File->New->project->console application->Go->C++-><project title>->GNU compiler->finish
then go to local disc (where project is saved) rename main file. Open project again in code blocks. Open main file it says file does not exist.
This method was quick but failed to rename main.
File->New->project->console application->Go->C++-><project title>->GNU compiler->finish.
then in code blocks at left side bar Sources/main/right click on main/remove file from project (then code blocks indicate you have deleted this main file but actually its not when I checked in local disk, main file was there). Then I create a new.cpp` file as File/New/File and next simple steps.
So finally I got what I want. A new project with .cpp file (name of .cpp file that I want). But I'm not satisfied, I want a quick method.
As of Code::Blocks 13.12 you can rename a file within a project
like this: Say the file to be renamed is main.cpp in project
MyApp.
In the C::B Management pane navigate in the Projects tree-view to
Projects -> MyApp -> Sources -> main.cpp.
Right-click on the file-icon of main.cpp. A pop-up menu appears.
The third item on the menu is Rename file. You can take it from there
Capture your code in a text file.
Close code::blocks
In the folder containing the files, rename all *.cpp and *.h or whatever your using including the cbp file. Don't need to change the depend or layout. Delete the bin and debug folders.
Double click the cbp (project file).
Remove the old files (right mouse click remove).
Then right mouse click on the project and select "add files".
Choose your newly named files, build and run.
In Code::Blocks 16.01, assuming your project and files are open:
If you want to rename main.cpp then, in the Management window, Projects tab, navigate to the Sources folder of your project and right-click on main.cpp. In the context menu that appears, if you find Close main.cpp menu item — click it! otherwise click Rename file...
If you want to rename the title of your project, in the Management window, Projects tab, right-click on the title of your project. In the context menu that appears click Properties... to open the Project/targets options window, and type the new title of your project in the Title field. NOTE that this will not change the name of the project folder or the name of your project's .cbp file, because the title of your project is stored inside the .cbp file.
If you want to rename any file or folder in your project, first close the project using the File menu, then, in the Management window, Files tab, navigate to the desired file or folder, right-click on it and choose Rename.... Proceed with care. You might want to delete old .dependand .layout files that are no longer associated with your project.
In newer versions of CodeBlocks, simply close the file editor and right click on the file (at left tree) -> Rename File.
When I add a new file in Xcode 6.3.2 I see templates for the .m and .h file but how do you add both at once?
I'm sure there used to be a way of adding both at once.
The option has been moved into the more generic "Cocoa Touch Class" template, which allows you to make the class in either Objective-C or Swift.
Complete the name of your pair of files with the default prefix filled-in for you. Choose the superclass such as NSObject. Choose the Objective-C language. Click the Next button, then choose the folder location where to save your pair of new .h and .m files.
You can do this by add new file and "Cocoa Class"
I installed Xcode 5 a few hours ago. I opened my project with it. I have several .h and .m file in my project. I could view all of them except one of my .m file. When i clicked that .m file, the cursor became rainbow and nothing happened.
To be sure , i checked my project folder, go to the that .m file and click get info. I could see the preview of that file. Also i could open it in text editors.
I couldn't find the problem. Any advice is appreciated.
Best Regards,
Taha
I created a new project to check that .m file. And the result is positive. But still i can't open that .m file in my real project.
Weird solution but works for me.
1) Delete .h and .m files.
2) Right click on xx.xcodeproj and click show package contents.
3) Delete project.xcworkspace.
4) Add .h and .m files again.
I have added a normal file, and in the .h file I've added the following code:
-(IBAction)PushButton;
My problem is, the action doesn't appear in the xib file when I go into "File's Owner".
I only have the problem with my "A" files. It works perfectly fine in the "M" files.
Any ideas?
May you have not set the class name in the xib