I have created an 'External Build Project' in Xcode 4 using a makefile. The project builds perfectly, except the only way I know how to get it to run is in Terminal.
Is there a way I can run the program in Xcode 4 or is Terminal it ?
Yes, you can!
Product -> Edit scheme
Select "Run" from the left panel, select "Info" from top and specify "Executable" drop list
Select next pane "Arguments" and add "Arguments Passed On Launch" (to "Executable" you select before)
Yes, you need to create a Custom Executable, so that Xcode knows where your built executable resides and how to run it. In Xcode 3 it's Project -> New Custom Executable....
This will allow you to to run your executable and even do source level debugging if you have added the source code to the project. The only minor hassle is that you have to manually select which custom executable is "active" when you switch between e.g. debug and release builds.
Note re Xcode 4: I don't use Xcode 4 but looking at the online help the nearest equivalent to Xcode 3's "custom executable" seems to be:
Customize Executables in the Scheme Editor
To customize the environment in which a product is launched in Xcode 3, you click the executable in the Groups & Files list and then open the Info window. In Xcode 4, choose Edit Active Scheme from the Scheme pop-up and choose the product you want to run (Figure 3-10). Note that you can choose to display the running product at a higher UI resolution to simulate running at a different display resolution.
Related
I already have a makefile project in C. There are multiple makefiles that are used through the command line to help automate the build process as multiple folders are available in the project.
How can the same makefiles be used in my Eclipse project for building / compiling the code?
Create a "Makefile project with existing code". Its project tree will include all the makefiles, given that they have common names.
Then use the view "Build targets" (menu "Windows" > "Show Views" > "Other") to create build targets in the respective directories. Please read its documentation to make the most of it. It is generally a good idea to read at least some of the introducing articles of the built-in help (menu "Help" > "Help Contents").
You might want to visit the project's or the general preferences for the build tool. For example, I like to unset "Stop on first build error" to get the make option -k.
I use this regularly, and it works really perfectly.
Note 1: If you deselect the standard make tool when you create a new target, you can even change the build command. On Windows you can even enter the name of a batch file, or any other tool. These build targets are really versatile.
Note 2: This Tutorial: Makefile Projects with Eclipse shows some of this in a nutshell.
I have a C program file in a folder. When I right-click on it and choose to open with other programs it doesn't show eclipse in the list of other programs.
Although I can start eclipse and it asks me to choose a workspace. By default, the workspace is in the C drive. But my C program file is in D drive. How do I open the C file in eclipse?
Eclipse is an IDE that requires a 'workspace'. This workspace is nothing but a directory residing in any of your drives where it can keep project-related files along with some meta information. Usually, you can create multiple projects within a single workspace. So, project is not a workspace, rather eclipse project(s) resides in a workspace.
To achieve what you are trying to do is very simple with these steps:
Launch eclipse
When it asks for a workspace location, note down the default it has proposed. It is typically a eclipse directory at C:/users//
Create a C/C++ project (Most likely console application or something similar verbatim)
Right click on project on your left, click add sources and select the C file you require
Build and observe the Console tab to check the build output
Note: The names for the options/steps I am suggesting may differ from what IDE you are using. I typically use eclipse-based IDEs for cross-compilers so the options may differ, but the concept is just the same.
I recently created my first Windows package for a small app I made using Kivy. I have a few questions with regard to running the app.
First, is there a way to get the app to run without a record log popping up in another window? It is just ugly and doesn't seem like something I want in my final "product".
Second, how can I run the app from my desktop? Right now I have a shortcut placed on my desktop, but if I wanted to send my app to a friend, how could I send it to them where they can simply have an icon on their desktop to click on?
Thanks!
The entire process is done in 2 steps.
Step 1: Make the windows executable files (not Python files)
You'll need to use PyInstaller to create EXE for Windows. Here's the link
https://kivy.org/doc/stable/guide/packaging-windows.html
You will notice a new folder created where all the files are kept along with the application executable file.
Step 2: Pack these into a Single Installer File (EXE you are looking for)
You can use a third part software like InstallForge to create a single package installer for these files.
This EXE file can be share with anyone and they can install the program just like any other windows software
I am extremely new to programming and have found that a good majority of my mentors use Visual Studio to code in C.
I would like to get an early start using SAMS C Programming.
Can anyone please tell me how to create a .c file in VS 2017? I am only able to create a .cpp file at this time.
Thanks
What you most likely actually want to do is create a project. Go to File-> New-> Project. Most likely, the first programs you will write are console applications (meaning they appear on that screen that resembles an old computer monitor, or what some computer screens look like when booting). If you want to create a console application, go from Project to Visual C++-> Windows Desktop-> Windows Console Application. Ignore any additional pop-up windows and just keep clicking continue. A file called main.cpp will automatically be generated. This is the file you will want to use for your code examples (but DO NOT DELETE the #include "stdafx.h" line, even if your example code does not have it).
Visual Studio compiles both .c and .cpp files as C++ by default. C++ has nearly everything that C has, but may take longer to compile when dealing with huge projects. If you want to use strictly C with no C++, then go to Project (a separate project tab on the same toolbar as the file tab -- it isn't within the file tab)-> ProjectName(Your Project Name) Properties-> Configuration Properties-> C/C++-> Advanced and select "Compile As". You should see a square with a upside-down "^" in it. Click that and select "Compile as C Code (/TC)". The "/TC" is just what you would type in if you were using command-line arguments instead of the convenient window that appears for you to modify everything. Finally, rename main.cpp to main.c.
Since you're learning C, I would also like to mention that I started making a C tutorial on my web site (and if anybody else also happens to see this post and the tutorial, criticize the tutorial as harshly as you can in the comments below).
Click on File, Choose Project --> Visual C++ --> Windows Desktop and under Windows desktop Choose Windows desktop wizard and give project name in the bottom then click on OK. a pop of Windows Desktop Project will come, check empty project and uncheck all options.then click on OK after that in the right side along with your project name more options will come..right lick on source file-> add -> new items -> choose c++ plus file but in bottom give file with extension .c..and you are done .enjoy coding
If you are truly interested in learning to program in C, then leave the VS Code IDE for later and learn to Build C/C++ code on the command line. VS provides a reasonably good compiler (cl.exe) and pre-configured command line (command prompt) windows to build both 32 and 64 bit applications.
The benefit to using the command line is learning what the compiler options are and what they actually do. Simply open a VS command line window and type cl /help. The compiler will list all options along with a short description. There are a great number of resource for command line building that can be accessed through the link above.
A second benefit is you can rapidly compile all your beginning C examples without worrying about projects, etc.. Just cl /nologo /Wall /Ox /Foname.o /Fename.exe /Tc name.c and you are done. (you will want to suppress unneeded warning with individual /wdXXXX options where XXXX is the warning to suppress) 50 Times faster than using the IDE.
Once you are proficient in using the command line, you will have a much easier time transitioning to the IDE -- because you can properly configure the IDE with the appropriate options for your build and you will know what the IDE is doing under the hood (or should be doing under the hood)
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
).