I have made a small c++ program using glfw, glut and dearImgui on linux machine. As i know, i have written this program so it should build on windows as well.
I would like to send this program to my friend who's running windows and doesn't have a compiler. How is it possible to build a program on a computer without a compiler?
Yes, you can make an installer for your c++ project that should allow your someone on windows to simply install and run it. There are multiple options for doing this but the first way that comes to mind for me is using cmake with cpack, but that would take learning how to use both, which, if you plan on continuing to use c++, is probably worth the effort in the long run.
Short term though, if you want to quickly send your project to your friend in a way he can run it, you can install a cross compiler for windows on your linux machine and just send him a compiled version for windows. Again, there are multiple options but I'm pretty certain MinGW should work for what you need, and be much simpler to learn quickly than cmake with cpack.
is there any Binary Decision diagram (BDD) is available in windows.i tried to run cudd in vc++6.0..which is mention link
http://web.cecs.pdx.edu/~alanmi/research/soft/softPorts.htm
but it isn't working properly.i get compiler error while running a sample code
I compiled CUDD for Windows, but using MinGW not a Microsoft environment. My goal was that compiler since I use Dev-C as IDE.
I did a first try using Cygwin, but with no luck. The second try was with MSYS, an environment to run unix commands that come with MinGW for Windows. Note that CUDD uses a couple of POSIX libraries (such as ). Luckily they are used only in two secondary functions: CPU stats and a kind of fork that I didn't fully understood. Since I didn't need those, I simply commented the portion of code (in util/cpu_stats.c).
Then you only need to write a Makefile for MinGW in order to link the library!
If you need it, I can send to you the library already compiled.
Question in one sentence: How can I compile code for AIX using G++ on Ubuntu? (Assuming it is possible)
I hope that it is as simple as adding an option to the make file to specify target processor. I am a novice when it comes to most things compiler related.
Thank you in advance.
What you are looking for is a cross-compiling toolchain.
A toolchain includes a cross-compiler (a compiler that runs on the current platform but builds the binary code to run on another, on your case, AIX), the C or C++ library, and some other interesting tools.
I have successfully used buildroot in the past, which is a tool that automates the process of creating a cross-compiling toolchain. I know they support several target platforms, maybe AIX is among them.
If you want to compile your toolchain by hand, take a look at the Roll-your-own section on this page.
Another approach, probably easier on your case, would be to install a AIX system inside a virtual machine on Ubuntu. This way you would have access to a complete AIX system running inside your machine, giving the opportunity to develop and test your application under real conditions (or whatever reasons you may find interesting for doing such a thing).
You'll want to download the right version of g++ (i.e., one that generates code for POWER, or whatever you're running AIX on), and compile that to run under Ubuntu.
Try to compile with -maix32 or -maux64 (like g++ -m32 file.cxx), it it doesn't work it means that it's not supported by your compiller.
This question already has answers here:
C++ cross-compiler from Windows to Linux [closed]
(5 answers)
Closed 9 years ago.
I need to write a relatively simple command line C++ program to be run a Linux environment. However, I would like to code as well as compile this on Windows. The reason I don't want to port it to Linux is because it requires MySQL interactions, and that would require some messy porting (IMO). It does not have to run on Windows; I just want to compile it on Windows because I want to use my preferred IDE's.
I've looked up on Cygwin for this task, but I haven't been able to find any documentation to do what I'm trying to do.
(I'm assuming "..don't want to port it to Linux.." is a typo for "..from Linux" and that you want the code to run in Linux as you said in your first sentence. This means cygwin or mingw would only be used as cross compilers and aren't going to be very useful.)
This program already builds and works (or mostly works) on Linux, right? No reason to change that. Use your preferred editor (probably the one in your IDE) to edit the files and then just run the build system (probably make) in a Linux system (possibly in a VM). Export the files using a samba share (especially easy from a VM) so you can edit and automatically save remotely.
Note that you seem fine ditching every other feature of your IDE (debugger and compiler, mainly) and just using the editor part anyway.
Ah, are you not starting from any existing project and want to write this from scratch? If so, porting doesn't make any sense. You want to write cross-platform code. (Cross-platform or "portable code" being related to, but different than, the act of "porting code" from one platform to another.)
The code is then both "Windows code" and "Linux code" at the same time, and you can use any compiler on Windows that can accept the code. Usually this happens by you sticking to standard libraries and other portable libraries, or writing shims for non-portable libraries to give them a portable interface, with the compiler supporting the C++ Standard.
You can use your preferred IDE's compiler and debugger in this case, and don't need cygwin or mingw. (Unless they're used by your preferred IDE. :P)
MinGW + MSYS
MinGW provides the functionality, MSYS gives a linux-like command prompt to use MinGW at.
When you get cygwin, install the C++ compiler/build tools, e.g., gcc, g++, make, autotools, etc. I think these are all you need, but I may be wrong. In any case the Cygwin installer is easy to use, and should bring in any dependencies.
Once you have these setup, you can configure your IDE to use g++ as your default compiler. You also need to set your library and include paths correctly such that they point to the relative /usr/include and /usr/lib directories under $CYGWIN (%CYGWIN%).
(Your other option is to use MinGW set of tools, in which case the IDE setup is more or less the same.)
Install cygwin (tutorial) and you'll have an EXE that gives you the command line prompt you're looking for.
The Cygwin installer should have an option for installing whatever compiler you're looking for (gcc?).
Here's another relevant tutorial.
I would like to know what I should use to compile in C. I am brand new to programing in general and would greatly appreciate a comprehensive explanation of this process. I am on Windows Vista.
I heard about something called "djgpp" that is free and effective for windows.
For the answer to this question and many others you may have as you start out, try [this website][1] which has beginner tutorials. [Here's the page][2] on compilers and getting set up. An excerpt on what compilers you can use:
Windows/DOS
Code::Blocks and MINGW
Borland
DJGPP
Dev-C++ and Digital Mars
Windows Only
Microsoft Visual C++
nix
g++ is a C++ compiler that comes with most *nix distributions.
gcc is a C compiler that comes with most *nix distributions.
Macintosh
- XCode
Personally, I'd also recommend you strongly to read [The C Programming Language by Kernighan and Ritchie.][3] It will really help you understand both core principles of programming as well as C-specific details.
[1]: http://www.cprogramming.com/tutorial/c/lesson1.html
[2]: http://www.cprogramming.com/compilers.html
[3]: http://www.amazon.com/C-Programming-Language-2nd-Ed/dp/0131103709/ref=ed_oe_h
Visual Studio Express is a free version of Microsoft's leading IDE for Windows, and it includes a C development environment (editor, compiler, debugger).
Depends on which platform, but on Linux, Mac OS X and similar (including Cygwin), gcc is most common.
Say I have a script named myapp.c:
#import <stdio.h>
int main(){
printf("Hi!\n");
return 0;
}
To compile it from the command line using gcc is very simple, just run:
gcc myapp.c
..that outputs the binary as "a.out" (the default filename). To run the compiled app, just do..
./a.out
#which outputs: Hi!
Or put it somewhere within your $PATH (for example, /usr/bin or ~/bin/) and run a.out
You can specify the output filename with the -o flag:
gcc myapp.c -o myapp
./myapp
# output: Hi!
As for more complete guides, "Learn C for Cocoa" is a good, quick guide on the C language, and covers compiling. If you're interested in learning ObjC, the next part of the guide is also great.
On Windows, I would recommend looking into Visual Studio, specifically the Express editions (which are free).
There's no "Visual C", but the Visual C++ edition will compile C code (since C++ is an extension of C). There's also an option to "Compile as C code" somewhere in the build options.
Finally, The C Programming Language book covers, well, everything.
I would recommend using gcc and getting comfortable with the command line, if you plan on doing C for any extended amount of time. *nixes probably have it built in, and on Windows you can install MingW GCC and use it the same way.
I find this helpful because I feel like C was designed hand-in-hand with Unix, so it's better to stick with the command line than use an IDE off the bat. Most tutorials will probably assume you are using gcc. Also, if you're just learning C with gcc, you just type gcc -o outputfile sourcefile.c, whereas if you're starting with an IDE you'll have to figure out how the IDE works.
On the learning front, definitely pick up Kernighan and Ritchie's "The C Programming Language" as it's the definitive book on C. Rather slim volume, and easy to read.
Just a note, another helpful compiler flag for gcc is -g, as in gcc -o output -g -Wall sourcefile.c. -g enables debugging symbols, which will be useful in the future when you want to start debugging with gdb. This is another reason why you should start with gcc rather than an IDE, it makes it easier to move on to gdb.
You could always use MS Visual C++, but I think it's too complicated for a beginner. I personally recommend Notepad++ for editing as it doesn't do too much for you, but it formats the code nicely. Of course, once you become more experienced you might want to move on to a full-blown IDE with project management and such (or better yet, emacs ;)) but when you're just starting out simpler is probably better.
If you're on Unix (i.e. Linux, Mac OS X, FreeBSD, Windows under Cygwin, etc.) I recommend the GNU Compiler Collection (gcc). To compile a file hello.c, run this at the command prompt:
gcc hello.c
This compiles hello.c to the executable a.out. If you want a better-named executable, try this:
gcc -o hello hello.c
This compiles hello.c to the executable hello. Some more helpful flags:
gcc -Wall -Wextra -o hello hello.c
This turns on lots of helpful warnings that will probably help you catch bugs in your code.
On Windows, many people use Microsoft Visual C++, but I have no real experience with Windows. As I referenced above, you can install Cygwin, and then use the above steps, but many prefer pure-Windows compiling. Also, MinGW is a native-Windows port of gcc. It's all a matter of preference, though.
Welcome to programming!
You might want to start in the right track and install a copy of Linux in your box. Try Ubuntu cuz it's easy to install and learn
Next learn to use the console! It will help you so much in the next years.
Once ubuntu is installed you need to install C compiler and basic libraries just typing in the console
sudo apt-get install gcc build-essential
Then just create a C file and run
gcc myprogram.c -o myprogram
This will generate an exec file called yourprogram, run it using
./myprogram
Here are some useful links:
Ubuntu Home
Compiling/Running C in Ubuntu Forums
Linux Tutorial - READ THIS!
I would recommend downloading Microsoft Visual C++ Express Edition. http://www.microsoft.com/express/vc/ DJGPP will work as a compiler but does not provide an editor or coding environment. Compiling your code involves going to the command line. Some have suggested using gcc or MinGW but both of those programs behave similarly to DJGPP. Using a separate editor and compiling your code from the command line is not really the way that software is typically written in a Windows environment. Visual C++ will allow you to write and compile either C or C++ code.
Microsoft Visual C++ is a free of cost development environment which includes an editor and a compiler. Simply download the installer executable and run it to install. The installer will download the necessary software from the Internet and install it on your computer. The installer will download about 200MB of software so it may take up to an hour to download depending on your connection speed.
Once you have Visual C++ installed, start a new project and write your code. You can then compile and build it right from inside Visual C++ and see the output. Start by writing a simple command line program and then work up to more interesting programs.
For windows now you can use gcc as mentioned above but also MSC. You can get the compiler for free with the Visual Studio Express bundle for Visual C++ Express
Invoking the compiler from the command line is fine for small apps as you're getting used to the C syntax, but as you move along, you will find that entering the myriad options gets tedious, and you will want to use a build tool. make is a basic but powerful way of compiling your projects easily. Editing makefiles by hand can be tedious, and will get in the way of your learning, so I'd suggest skipping right over that and go for the autotools toolchain.
Ok Josiah, first of all, be sure to have a C compiler installed on your system. On Linux, Mac, there's a compiler installed just out of the box, called the GCC compiler. And on Windows, you need to instal one, I recommend you to instal an IDE (like devshed) that includes an editor, compiler, debugger... all that you need to develop a C/C++ application.
In order to compile over Linux/Mac, first of all you'll need a source file (a text file with your code) and save it with a .c or .cpp extension. Then open your terminal and type:
gcc <fileName.c>
You should replace <fileName.c> with your filename (the full path, or first go to the files location and just type the file name).
This will create a .o file (and object file) in the same path of your source file, this is the executable file for your computer!
On windows, if you already installed an IDE, is easier, you just click the compile button and there ya go!
I hope this to be helpful to you