C programming in UNIX environment

In summary, if you are in a UNIX environment and want to write C code, you should use the Gnu C Compiler, known as GCC. cygwin is a good option to use if you do not have access to a UNIX environment. Alternatively, you can use DOS and log onto a lab machine to work on your programs. If you are new to C programming, you can use Emacs or notepad to write your code. Last, if you are having problems with your code, you can try to log onto a server or lab machine and use the Unix environment there.
  • #1
brad sue
281
0
Hi,
I have a question about C programming.
I am going to take a class of C programming and we are going to write the codes in a UNIX environment.

Because I do not have access to a "SUN" computer, is there a possibility to have a compiler that permits me to write under Windows XP but can work under UNIX system?

OR what do you suggest me in this case?

I hope that you understand what I mean.
Thanks

B
 
Technology news on Phys.org
  • #2
use FreeBSD.. wouldn't that be a similar enviroment?

You could get VMware and install it as a virtual environment beside xp
 
  • #3
Anttech said:
use FreeBSD.. wouldn't that be a similar enviroment?

You could get VMware and install it as a virtual environment beside xp

OK thank you very much for the tips.
B
 
  • #4
cygwin is a very good unix shell emulator that i used for awhile while i still used windows
http://www.cygwin.com/
i suggest installing all packages
--shawn
 
  • #5
If your in a unix environment you're probably going to use the Gnu C Compiler, otherwise known as GCC.

As shawnzyoo mentioned, Cygwin is probably your best bet. It comes with a windows port of GCC.
 
  • #6
Shawnzyoo said:
cygwin is a very good unix shell emulator that i used for awhile while i still used windows
http://www.cygwin.com/
i suggest installing all packages
--shawn

Hi Shawnzyoo,
I try to download cygwin. I believe it works, but can you please give me some indication on how to create a C program with Cygwin?

I am new in the C programming! I try the emacs but I don't know how to use it.
(Of course I will need to compile and debbug those C programs)
Thanks

Brad
 
Last edited:
  • #7
if you have all the correct packages installed
and want to use emacs, vim, pico, nano, or whatever
just type
emacs yourfilename.c (or cpp for c++)
it creates a file of "yourfilename" and opens it with emacs
then just code away and save it when you are done
then compile it (i think cygwin has the G++ compiler installed)
barring no errors, it should run just fine
--shawn
 
  • #8
Live UNIX

:smile: That's not a very good solution but try it. It's live UNIX via Internet.
The address is http://sdf.lonestar.org"
Through DOS environment: Start->Run->"cmd" and then write "telnet"
Then in the telnet write:eek: sdf.lonestar.org.
Tobecome a new member type new and wait.
This is very efficient for the ones who don't have UNIX and want to have one!:biggrin:
 
Last edited by a moderator:
  • #9
I am new in the C programming! I try the emacs but I don't know how to use it.
You can use notepad too. (But I would suggest learning how to use emacs or even vim if you're that kind of person)
 
  • #10
Your school intends for you to program in a UNIX environment, but then doesn't give you access to a UNIX environment, or teach you how to set one up? I think you should be speaking to your professor, personally.

- Warren
 
  • #11
I bet they use Unix in the labs at school, but he wants to be able to work in his dorm room or at home and not have to go to the lab to work on his programs.

If this is an introductory C course, it's almost certainly going to do standard console-based I/O and not interact specifically with Unix system calls. That is, it will use standard C code that can (in principle) compile and run on any platform. So he should be able to use a Windows compiler. He just needs to find out how to set up a "console mode" project that doesn't use any Windows-specific libraries.

Another possibility is that he might be able to log onto one of the lab machines, or a server, from the dorm or home using a telnet or SSH client. Then he can use the lab's Unix environment (at least via the command line, perhaps not via X Windows) from his Windows machine. That's the sort of setup we use here for C and C++. When people work on programs in the lab, they actually telnet to a server that they can just as well access from home.

He should definitely talk to his instructor about what the possibilities are at his school.

[added: Oh gee, I just noticed the original question was posted at the end of December! So his class has probably finished by now. Maybe someone else can get something out of this thread, anyway.]
 
  • #12
Learn ANSI C.

Problem solved.
 
  • #13
The GNU g++ compiler for windows: http://math.claremontmckenna.edu/ALee/g++/g++.html

(It probably comes with cygwin).

ps: if you're runnin it in your dorm, why not get a live linux distro, such as, ubuntu?

pps: I though c++ code had a .cc extension :smile:
 

What is C programming?

C programming is a high-level programming language developed in the 1970s by Dennis Ritchie. It is widely used for system and application software development, particularly in the UNIX environment.

What is the UNIX environment?

The UNIX environment is an operating system developed in the 1960s and widely used in computer systems today. It is known for its stability, security, and flexibility, making it a popular choice for server and mainframe systems.

How is C programming used in the UNIX environment?

C programming is the primary language used to develop software for the UNIX environment. It is used to create system utilities, applications, and drivers. Additionally, many of the core components of the UNIX operating system are written in C.

What are the benefits of using C programming in the UNIX environment?

Using C programming in the UNIX environment allows for efficient and robust software development. C is a low-level language that provides direct access to hardware and system resources, making it ideal for system programming. It also has a large library of functions and is highly portable.

What are some common challenges when programming in the UNIX environment?

One of the main challenges of programming in the UNIX environment is understanding the complex system architecture and its various components. Additionally, managing system resources and ensuring compatibility across different versions of UNIX can also be challenging. Debugging in a multi-process environment and handling errors and exceptions are also common challenges faced by programmers.

Similar threads

  • Programming and Computer Science
2
Replies
65
Views
2K
  • Programming and Computer Science
Replies
10
Views
1K
  • Programming and Computer Science
Replies
8
Views
878
  • Programming and Computer Science
Replies
14
Views
2K
  • Programming and Computer Science
Replies
11
Views
1K
Replies
6
Views
1K
  • Programming and Computer Science
2
Replies
37
Views
2K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
16
Views
1K
Back
Top