Codeblocks adding files to current project doesn't work - codeblocks

What I mean by this is that usually in codeblocks when you create a new file while you have a project open asks you to add it to the project, and when you do it'll be tied to it so when you open the project file it will have the files with it, but this doesn't work for some reason, also right click in management doesn't work, just the whole management panel seems to be broken.
TL;DR: Codeblocks doesn't add newly created files to current open project file.

I get all sorts of errors and crashes in CodeBlocks... I'd create the file you want, then manually add it to the project folder (outside of CodeBlocks with file explorer/Finder/terminal) you want it in and refresh...

Related

Does anyone know if it is possible to open a C++ file outside of an XCode project and still be able to run it?

When you open a .cpp file with XCode, you can edit it and everything, but the run button doesn't show. You can convert it to a workspace, but even then, the run button is greyed out, even if you create a new scheme (since you can't create new targets in a workspace). I have also tried File > New > Project, but it doesn't transfer the files that are already in the workspace into the project. Help!

Changing the name of main folder in Xcode project

This is not the first time I've had trouble with this and I suspect not the last time either. Despite having learned many frameworks inside out I still find the organizational structure of a simple xcode project elusive. I simply wanted to retitle a project from CATouchSynth to ABTouchSynth. A while ago I discovered that if you click on the Project folder in project navigator and than change the name in the Identity and Type section it will rename many of the relevant files and directories to the new name. However, there is one main folder inside the folder on your computer that doesn't change and still has the old name. I could see no way to change this folder name through Xcode and so I renamed it manually from finder. This turned all of my source files and assets red so I manually "relinked" them in xcode and they are now non-red and seemingly linked with the newly named folder. However I am getting several compile-time errors talking about the old folder name but I have no clue what Xcode is referring too. The errors look like this
It seemed as if derived data was an issue so I deleted the derived data folder from Xcode and I still get these errors. Has anyone experienced this before and what can I do to ressurrect my project?
Note: Before doing any changes do backup your project folder. This is seriously recommended.
Follow the steps below to rename the source folder of your project –
Close XCode.
Rename the Source Folder.
Right click the project bundle .xcodeproj file and select “Show Package Contents” from the context menu. Open the .pbxproj file with any text editor (Xcode).
This step should be done with extreme caution. Search and replace any occurrence of the original folder name with the new folder name.
Save and Close the file.
Open XCode project.
The error is happening at build time during the compile phase, so you will have to go into the app target's Compile Sources build phase, remove all those .m files, and add them again.

Create File Structure

Hello I've got a little problem while trying to create a new Project.
My aim is to get a total folder for sourc files, headers, external dependencies and ressource files auto generated.
Visual Studio does not create this folder for me.
I tried to activate and deactivate the plug in for controlling source code folders but it doesnt help.
At the beginning, when i ve created my first couple of projects it automaticallyy generated this folder. But now I do get nothing but my Project file without a source or a header folder
Thank You for every Help
When you are creating a new project there is a check box right above the OK button that says "Create a directory for this solution". Make sure this box is checked.

How to refresh Project Navigator content in Xcode?

I'm not able to refresh file list in Project Navigator. There is no refresh button, and I don't think restarting Xcode should be the solution.
How do you see files that you add externally? I'm on Mac.
How do you see files that you add externally?
Files cannot be added externally. Dumping a source file into the project directory does not add it to the project. To add a file you must add it to the project from within Xcode.
If you have a bunch of files that you need to add then in the Add File dialog you can just select all the files you want at once and add them, without having to repeatedly open the Add File dialog. Just use control clicking to select multiple files.
Close and reopen the project, if necessary.
This may be required if you are using folder references (as one example). In that case, touching the directory might work to refresh what Xcode displays.
For a single file, you can open the external file in Xcode and cmd+s to save it, it will be refreshed in Xcode.
Also, for the quick way you can just chose the external folder in Xcode and cmd+s, it will refresh all your external file in this folder.
File > Add files to "Runner" 👍
I don't think you can refresh the Project navigator to detect files that have been modified outside of Xcode, and that instead you need to manually add or delete files from the Project navigator with "right-click" / two-finger tap.
Some other solutions suggested:
File > Add Files to "Runner"... but that doesn't delete files
Open and close Xcode, but that's not practical. It also did not work for me.
Use cmd+s, but Xcode does not detect files which need to be saved. And so, that also did not work for me.
You can just press "Command + B", for refresh your project in xcode

Visual Studio Copy Project

I would like to make a copy of my project. I would rather not start doing it from scratch by adding files and references, etc. Please note that I don't mean copy for deployment. Just plain copy.
Is there a tool in VS to do this? I am using VS 2008
Just create a template;
From your project choose: Project - Export Template
The wizard will let you define
Template name
Template Description
Icon
Preview image
Then it zips up your project into 'My Exported Templates' directory.
You also have the option to make your template available when you create a new project.
When you use your template to create a new project, the namespace will be correct for 'your_new_project_name' throughout every file, all references correct, everything perfecto :)
You can send the .zip file to anybody, and they must copy (not unzip) the .zip file into Templates\ProjectTemplates directory for them to use too.
I made an ASP.NET MVC template with folders, layout page, viewmodels etc arranged just how I like them.
NOTE:
If you have an empty folder in your project, it WON'T be added to the template, so I just added an empty class appropriate to each folder, and a sample picture for images folder.
If you want a copy, the fastest way of doing this would be to save the project. Then make a copy of the entire thing on the File System. Go back into Visual Studio and open the copy (by right clicking on solution => add existing project => open the copied project). From there, I would most likely recommend re-naming the project/solution (Steps of Safely Renaming Project are in the following link) so that you don't have two of the same name, but that is the fastest way to make a copy.
It is highly NOT ADVISABLE to copy projects at all because the some config files formed internally like .csproj, .vspscc etc. may (and most probably will) point to references which belong to previous solutions' location and other paths/locations in system or TFS. Unless you are an expert at reading these files and fixing references, do not try to copy projects.
You can create a skeletal project of the same type you intend to copy, this creates a proper .csproj, .vspscc files. Now you are free to copy the class files,scripts and other content from the previous project as they will not impact. This will ensure a smooth build and version control (should you choose to be interested in that)
Having said all this, let me give you the method to copy project anyhow in a step-wise manner:
Go to the project you want to copy in solution explorer and right-click.
Now select 'Open Folder in File Explorer' (Assuming you have the solution mapped to a local path on your disk).
Select the Projects you want to replicate as whole folders(along with all dependencies,bin .vspscc file, .csproj file)
Paste them in your desired location (it could be your same solution folder or even another solution folder. If it is within the same solution folder, then you would be required to rename it, also the .csproj and other internal files to the new name).
No go back to Visual Studio, Right-Click on Solution > Add > Existing Project...
Browse and select the Project file (.csproj file) now from the location you placed it in and select 'open'
This file now appears in the solution explorer for you to work.
You may now have to resolve a few build errors probably with duplicated/missing references and stuff but otherwise it's as pristine in logic and structure as you expected it to be.
I guess if this is something you do often, there's a little (non-free) utility that promises to do it for you: I haven't used it, so not sure how good it is:
http://www.kinook.com/CopyWiz/
There is also this project on CodePlex:
http://clone.codeplex.com/
I will probably give the codeplex project a try, and if it doesn't work I'll manually rename everything and edit the sln file.
I follow these steps and I use the development tool called Resharper ,which is awesome by the way:
So,
Copy the existing project folder to the destination you want
Go to source control and with right click just to the root folder you want and pick "Add items to folder...".Then, a wizard will come up to choose the files to copy (there is no need for some files and the wizard guides you for that reason by default).
Change the name of the solution file (*.sln)
Change the names of the sub-projects if exist.
Use Resharper to change the binding namespaces name (I will automatic do the dirty job with safety).The alternative way is to manually change all namespaces with the new name.
The same action with method names.
Check solution's properties if you want to change.
That's it. You are ready!!!
Following Shane's answer above (which works great BTW)…
You might encounter a slew of yellow triangles in the reference list.
Most of these can be eliminated by a Build->Clean Solution and Build->Rebuild Solution.
I did happen to have some Google API references that were a little more stubborn...as well as NewtonSoft JSon.
Trying to reinstall the NuGet package of the same version didn't work.
Visual Studio thinks you already have it installed.
To get around this:
1: Write down the original version.
2: Install the next higher/lower version...then uninstall it.
3: Install the original version from step #1.
The best way is actually to create a new Project from scratch, then go into the folder with the project files you want to copy over (project, form1, everything except folders).
Rename the files (Except for form1 files) for example: I copied Ch4Ex1 files into my Ch4Ex2 project but first renamed the files to Ch4Ex2.
Copy and paste those files into the Solution Explorer for the new project in Visual Studio.
Then just overwrite the files and you should be good to go!
Old thread but I hope it helps anyone looking for this answer!
The easiest way to do this would be to export the project as a template and save it to the default template location. Then, copy the template into the exact same directory on the location you want to move it to. After that, open up visual studio on the new location, create a new project, and you will get a prompt to search for a template. Search for whatever you named the template, select it and you're done!
I have a project where the source files are in in a folder below the project folder. When I copied the project folder without the source folder and opened the copied project, the source files are not missing but found at the old location. I closed the project, copied also the source folder, and re-opened the project. Now, the project magically references the copied source files (both the new path showed up on "save as" and a change in a file has been saved in the copied version).
There is a caveat: If not both old and new project folders are below a used library folder, the above-mentioned magic discards also the absolute reference to the library and expects it under the same relative path.
I tried this with VS Express 2012.
My solution is a little bit different - the computer that the package resided on died and so I was forced to recreate it on another computer.
What I did (in VS 2008) was to open the following files in my directory:
- <package name>.djproj
- <package name>.dtproj.user
- <package name>.dtxs
- <package name>.sln
- Package.dtsx
When I did this a popup window asked me if the sln file was going to be a new solution and when I clicked 'yes' everything worked perfectly.
After trying above solutions & creating copy for MVC projects
For MVC projects please update the port numbers in .csproj file, you can take help of iis applicationhost.config to check the port numbers. Same port numbers will cause assembly loading issue in IIS.
I use Visual Studio 2013 where Project > Export Template is not an option. Here is what I use to clone a project.
From your solution:
File > Export Template > select project to make template from, note save path
Download and install VS 2013 SDK Here
Create new VSIX project under Extensibility
From the VSIXManifest Dialog select the Assets tab
Fill in the Author textbox
Choose "Project Template" for Type and Browse to add the exported template (saved at path you noted in step 1)
Save and build the VSIX project. Go to the VSIX project's .../bin/Debug folder and double click to run the .vsix file
Start new instance of Visual Studio and you should see your template under whatever project type your template is. Create a new project from your template
You will have to re-add any dll references
Trick the Clone from repository tool
Open the project location in file explorer.
Copy the path to any browser (aka open the project location in the browser).
Use the address from the browser as the source repository for cloning.
Relax and enjoy the no error clone.

Resources