Jeff
Jeff

Reputation: 757

How do I setup a C environment on Windows (and maybe Linux compatible, too)

Short version of question: How do I get started with C programming? Note that I am not asking for a tutorial on learning C language (I can learn that easy enough). I need to setup the environment (I hope I'm asking this question clearly). Here's what I mean:

For my math thesis, I need to write a program in C on Gentoo Linux, using a library called CVODE/SUNDIALS. There is nobody (it seems) in my department who can help me set this up - my professor has left the computer work 100% to me because I have some programming background and he's a math geek. But my experience is with scripting languages (think VBA) and not full, powerful programming languages where you have to link the compiler and libraries, etc. like C.

There is no development environment on the Linux cluster - or at least not that's friendly, and has a debugger - that I've found. So, what I need to figure out how to setup a C programming environment with CVODE library on my PC (Win 7 x64, at little to no cost.

I have found plenty of tutorials on programming in C. I looked up Eclipse, which I have a little bit of experience with, as a development environment, but it's instructions say you need to install a compiler, too.

What I would like is someone to tell me, in simple language that I can understand (which might be the most difficult part of this question) the big picture of what I need and what to do (and maybe even links to where I can find what I need) to set up a C environment with CVODE. If the information is Windows/Gentoo Linux cross platform, even better.

Thank you.

P.S. I did search the site and saw lots of "How do I setup" quesitons, but no C one. Because I know someone will yell at me for that. Also, I don't want to have a convo about whether to use C#, C++, Java, etc. That just complicates the issue - and I need to get this done.

Edit: I have learned a little more since this question and now realize that I left out a key part of the question. The CVODE library and Linux cluster at school use MPI - parallel programming - which is not available on your average, run-of-the-mill PC. So all development must be done directly on the cluster.

Upvotes: 0

Views: 1319

Answers (4)

Jeff
Jeff

Reputation: 757

These were all useful answers. I tried pursuing each of them at least a little bit. However, the only reasonable solution seems to be to use emacs on a terminal window. This is because I'm using MPI - yes, I know I didn't mention that in the OP - which can only be done on a cluster.

I am new to this environment and was not aware of the MPI or the affect it would have on my attempt to develop.

I believe I can do better than this if I can figure out X/Windows using Cygwin. But I am a long way from that.

Thanks all for your effort and sorry I can't really award a best answer (I guess).

Upvotes: 0

TOC
TOC

Reputation: 4446

You said that you want to write c code on Gentoo Linux, as i understand you're not familiar with Linux? The best choice in this case is to:

  1. Install virtualbox in your windows machine (https://www.virtualbox.org/), it's a free software that let you emulate in your desktop another systems like Linux...

  2. Install Gentoo linux on virtualbox, there are a lot of tutorials on the net, for example this video: http://www.youtube.com/watch?v=DUf_1wAPeyA

  3. When you install Gentoo Linux on virtualbox you have all you need to develop C (gcc compiler, gdb debugger...)

  4. Now you can download your library, and decompress it

  5. In general all (Good) Linux libraries come with a 'README' file that contain all instructions for installing the library. I think you need to do this:

    ./configure --prefix=/DIRECTORY_YOU_WANT_TO_INSTALL_THE_LIBRARY
    
    make
    
    make install
    
  6. You can now play with C and you new library, like this: suppose you create a new file test_lib_ CVODE.c you can compile it like this:

    gcc -Wall test_lib_ CVODE.c -o test_lib_ CVODE -lcvode
    

I assume that the installed library is named libcvode.so

If you have any questions, you can always get help here.

Regards.

Upvotes: 2

sonnet
sonnet

Reputation: 21

I think you should use Code::Block in Linux, it is very similar to Window's Code::Block and it is very easy to debug and other things.

Upvotes: 0

user1543051
user1543051

Reputation:

Linux: Simple way is to install gcc or g++. You can write your code in your plain text editor (nano, vim, gedit, kwrite, etc) Save your file in .c or .cpp extention and type in terminal

gcc filename.c

or

g++ filename.cpp

Upvotes: 2

Related Questions