This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
One of the requirements for my college project is that my C file must be gcc compilable.
I do not know what this means and I do not know how to go about determining whether a C file is gcc compilable or not. How does one do this?
At the moment, I am using VS 2012 to compile my files. Part of the requirements for the submission of the code is that it must be able to be executed on the command line.
Download GCC and attempt to compile the file with it.
Don't use headers or library functions that are specific to Windows or MSVC. For example (and yes, I'm dating myself here) the "conio.h" file and functions declared in it are not recognized by gcc.
If you limit yourself to what's defined in the language standard, then your code will compile under gcc.
The easiest way to get started compiling with GCC on Windows is to install the version of Code::Blocks that bundles MinGW's gcc environment.
http://www.codeblocks.org/downloads/5#windows
You're looking to download the codeblocks-10.05mingw-setup.exe
When you create a C or C++ project with that version of Code::Blocks, gcc will be the default compiler and you're all set. (until you start needing to do anything like I/O multiplexing, at which point you'll need a real Unix install)
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Backstory: I have searched around and read some questions from SO, but I am still somewhat confused.
I learnt C at University, only been here 1 semester and we're on break.
I learnt to program in C under a Unix environment, Mac OS X and Ubuntu and it was dead easy.
Open terminal, install GCC, start using vim and writing some make files for your projects and you're done.
I have removed my Ubuntu partition since I only used it for C programming, I am too grounded in Windows (games etc...) and I am looking for a similar experience on Windows.
I don't particularly want to install anything from .NET at all, since it's never just the application, but 500000 other useless things - which pisses me off to be honest.
TL;DR;
I heard MinGW was using an extremely old version of gcc and isn't maintained, otherwise I would be using that.
So does anyone know of a gcc, no nonsense port or otherwise for C programming on Windows?
I can use Notepad++ for writing the .c files and syntax hilighting, I don't care about an IDE at all.
The easiest way would probably be to install cygwin (you may need to explicitly select "gcc" from the development section). If you had worked on unix, it would probably be a good idea to cygwin on your windows machine anyways.
You can use an IDE such as visual studio that will bundle all the needed features (compiler, libraries, etc)
If you don't want to bother with an IDE and prefer the lightness of vim, installing it on windows and compiling in the CLI is a pain, Cygwin is cool (see other answer) but I can't bear the windows terminal compared to the Linux / Mac ones.
Maybe consider using a Virtual Machine running Ubuntu for all your development.
The answer to your question is NO.
You either use MinGW, or you use Visual Studio. There is no lightweight third option, unless you want to use Turbo C.
I am using MinGW now - I was informed incorrectly about it using an outdated version of GCC.
In a way, I suppose I deserve the down votes for not checking myself.
Oh well, you live and learn.
Try these:
CodeBlocks:
http://www.codeblocks.org/
Eclipse, as someone mentioned earlier too;
-older versions of programs are good for learning too like:
Borland C++ 3.1
Turbo C
(both DOS based)
Try Visual studio 6.0 :)
no .NET on that release.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm quite interested in getting "stuck in" to some Unix source code, say Fedora or Ubuntu.
In practical terms, how would one "re-write" some part of the Unix OS. I presume you would need two machines, a dev machine and a tester? Would you need to re-install the OS on each modification of a .c file? How could I edit the file and re-compile it etc?
What resources are there for knowing which parts of a Unix OS/Kernel relate to which C files (I presume there is no C++) and how to find them?
Thanks in advance for help
ps my motivations for doing this are to eventually be able to learn more about the lower-level fundamentals of the Unix OS, so that I could try and get into programming high freq trading systems.
I think it would probably be a good idea to have some kind of virtual machine to experiment with, that way you could do a snapshot apply your changes but still be able to go back without much effort. Also it allows you to simulate communication between PCs in a simple fashion.
First you need to know what you're looking for. You want to download and look at the: linux kernel. Which is the same for Fedora and Ubuntu (and all other GNU Linux distributions). Second, you might want to start with something easy, like downloading the kernel, configuring and compiling it and booting it. Once you do that you can move up from there.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I'm trying to create a program using Xcode. The program is very simple, it uses threads.
I have done everything right. Or so I thought. This error comes up and I have do ideia what it means!
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1
along with:
ld: duplicate symbol _thr_inc_low in (... a bunch of crap that is the directory of this file) main.o
Can you please help me?
It means you have multiple .o files or libraries that include the symbol _thr_inc_low.
One of the common reasons for this is defining an object in a header file (rather than just declaring it, say with an extern or a prototype) that is included in multiple source files.
Can't tell more without seeing the relevant parts of your source code.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I am using Visual Studio 2010 Premium version
When I run the profiler, it runs fine, but then it just produces results telling me that my app [appName.exe] (brackets are theirs) is using 99.99% of the time spent.
I googled trying to find anyone reporting similar issues, but to no avail. I am using Windows 7, compiling using x64 for my multi-threaded app. However, even when I turn off all the multithread pragma directives, same results.
The last time I used the profiler on my app it worked as one would expect, telling which functions were the most expensive.
Btw, I am using c, not c++, if that makes any difference.
Any ideas?
Thank you. Apparently somehow I got it set to analyze the release (vs debug) version.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have purchased The C Programming Language ANSI C Version book for learning C. In that, there is no instruction for setting up the environment for developing the C programs.
Please help me how to compile and run the code explained in the book.
EDIT : I have Windows 7 installed as the OS"
You should use an IDE (Integrated Development Environment). I've chosen Code:Blocks a long time ago and I am still happy with it. Alternatively you can use NetBeans, Eclipse, DevCpp, ... There are a lot of IDEs for C or C++ available.
If on Mac/Linux, you can simply use make myprogram (in a terminal) to easily compile a single-file C program where the source file is called myprogram.c
For more complex programs with several source files, system dependencies et c, it quickly gets much more complex. Use google to find the basics of GCC, the default compiler on UNIX systems.
If you're on Windows, you could either use the Visual Studio from Microsoft (excellent, but not free) or Eclipse with CDT.
This provides you a full IDE with nice debugging support.
However, if you don't want to use an IDE but learn to build programs from scratch, cygwin would be an option including GCC and Make.