I'm relatively new to VS (only used it once before for a simple project) and all I want to do is create a new C file for my project. When I go to add file to the project I created, the only available language option I'm remotely familiar with is C++. I chose that and tried saving the file as a regular C file, which VS let me do, but it saved it as a separate file outside of my project. Is there a way I can add this C file to my project? I've tried playing around with some of the options and I can't seem to find a way.
On Solution Explorer, Click on the Source Files folder. Press Shift + Alt + A to add an existing item to the sources folder. Then just choose your .c file.
Works for me.
Right click on the Source Files folder from Solution Explorer -> Add -> Existing Item ... and choose your file.
I don't have a copy of VS handy at the moment and cannot check, but I believe it should be possible to create a new .c source file. What you can do for sure is to create your .c file outside of VS and then drag it into the solution explorer. Always works.
Related
my problem is :
I have a VB .NET project, with an installation project made with the old poor "Visual Studio Installer".
The version of Visual Studio I'm currently using is 2015.
Now I need to insert into the installer project a huge amount of file, from different directories,
and the IDE doesn't let me to add multiple files in subdirectories, with a simple "copy and paste into".
Apparently, I have to manually create, into the file system, every sigle directory that I want to have in the final installation.
I've already did a little program that inserts those files programmatically into the main project file (.vbproj), that's simply an xml file, but the .vdproj file seems more "tricky" do manage,
it contains GUID numbers, as 9F6F8455-1EF1-4B85-886A-4223BCC8E7F7 that I'm not sure I'd want to tangle with.
Anyone has ever dealt with a problem like this?
I solved by myself.
Simply I was wrong, you can actually copy the directories you want to add, from a file explorer windows, and then paste it into the File System Windows of the installation project.
Anyway, I think I'm leaving here this question, in case anyone else would need that.
I am trying to replicate one coding example in Visual Studio and I see that in a form there are some resx files.
I am trying to put a resx file into my form as well so I created a new resource file but as I try to move it on the form in solution explorer i get an error saying i cannot do that ("destination folder is the same as the origin")
I am new to Visual Basic so maybe I am missing something but where am I doing wrong?
Rename the copy of folder and files because two folders with same name can not exist at same place.
Copy file to outside anyway rename and again paste there.
I've downloaded VS2017 Community Edition and I'm working through "Programming in C" by Stephen G. Kochan.
I'd like to store all the examples in one project (possibly 1 project per chapter), however I've come across the error about multiple "main" files in one project. Before telling me I can't have multiple main's in a project, could you suggest the best way to organise these small C programs in VS2017.
I love the fact that I don't have to use a terminal compiler and would like to use VS2017 to work my way through the book.
Any suggestions?
A typical case of "assignments" in a course. In that case you can create one module (c file) for each assignment and call the current assignment from your main. Now you have all assignments in a single project, so you can easily look them up. Assignments completed you can comment-out.
I don't think you really want them all in one project. I think you want them all in one Solution, with each example in its own Project. That way you can switch between projects in the IDE and build/run/debug whichever one you are working on at the time.
Add a new project to your solution by right-clicking the solution in Solution Explorer and selecting Add->New Project from the menu.
Set the active project by right-clicking the project in Solution Explorer and choose "Set as startup project" from the menu.
This allows you to build each example on its own, or build all of them at once. Each project is self-contained and generates its own executable, and you can navigate around from one project to another inside the IDE.
You can compile and run your C files individually from command line.
This is not ideal when using an IDE.
Your other option is to use add_executable command in cmake
Adds an executable target called to be built from the source
files listed in the command invocation. The corresponds to the
logical target name and must be globally unique within a project. The
actual file name of the executable built is constructed based on
conventions of the native platform (such as .exe or just
).
I got this weird issue, when I make external changes on files (like removing a file or make new ones), Visual Studio 2012 (Ultimate) doesn't detect the file changes. Right now, I deleted ~15 and copied a lots of new files in windows explorer, but in my solution, it shows the old files and says there is an issue with them.
I turned on "Tools"->"options"->"Environment"->"Documents"->"Detect when file changes outside..." and the one under it. Doesn't help.
(Right now, I am working on an MVC4 project.)
I found a somewhat solution:
Project->Show all files
Right click on everything you want and select "include in project"
You can do the same, with the files you already deleted, but the VS shows you as an issue. (Exclude from project)
I have just recently started using Atmel Studio 6 to program an SAM3S4A that I recently bought. When compiling, it states from inside the file "pio_handler.c" that the file "exceptions.h" is missing. There seem to be many copies of this same file lying around in various locations within the Atmel program files folder. Where can I find the correct copy of this file to include so that I may finally use this chip?
Try creating an Atmel board new project based on SAM3S4A. Once you have done it, go to:
src/asf/sam/utils/cmsis/sam3s/source into the Solution Explorer window.
Now make a copy of this directory structure in your won project.
Finally add each file.
Now do right click on you project name into Solution Explorer and select properties.
Select Toolchain from left side options. Now choose ARM/GNU C Compiler…Directories. Now add a new path pointing to:
../src/asf/sam/utils/cmsis/sam3s/source/templates
Build again