Posts: 6
Threads: 4
Joined: Oct 2016
Hi
I need to code some program in C
Do I have to compile it under linux ?
Can I compile it under WINDOWS and when verifid can I upload and run the
compiled C code to my linux and run it under linux?
Thanks
elico
Posts: 687
Threads: 37
Joined: Sep 2016
No, you can find find C compilers for Windows. The canonical free compiler is GCC, and you'll find Windows version for it, but they come with whole command-line environments that emulate the Linux one (MinGW or Cywgwin).
The code you compile on Windows to debug on Windows won't run as is on Linux, it will have to be recompiled for Linux (different formats for executable code). If you create a makefile this will be quick and easy.
This said if the code targets Linux better develop it on Linux... What keeps you on Windows? A text editor?
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Posts: 4,646
Threads: 1,493
Joined: Sep 2016
all major linux distributions come with a free C compiler ... except the tiny ones for special purposes like network firewalls.
learn to do things on linux. you can even use python there. if you are into multi-lingual programming, you should also do multi-platform stuff. this will make it easier to get a better job.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 12,030
Threads: 485
Joined: Sep 2016
Oct-29-2016, 05:19 AM
(This post was last modified: Oct-29-2016, 05:21 AM by Larz60+.)
I have used both of the compilers that Ofnuts suggested.
Both (from all that I've done with them(a lot)) are bug free as far as I can tell
Cygwin is pretty much a complete UNIX/POSIX system, and when you bring it up,
you would think you're on a UNIX system. You might like this. It is a bit quirky to
install, and may ruffle your feathers a bit, but that's a one time frustration, and there
are some good installation write-ups available.
MinGW on the other hand doesn't require all the dll's that Cygwin requires, and installs very
easily with just MSVC.
MinGw is here or here
Cygwin is here
[url=https://www.cygwin.com/][/url]
Posts: 4,646
Threads: 1,493
Joined: Sep 2016
Oct-29-2016, 06:38 AM
(This post was last modified: Oct-29-2016, 06:39 AM by Skaperen.)
the executable and library file formats are different between linux and windows. if you want to make one run on the other, you will need to cause the tool programs that build these to build for the other using the other's format. the simpler way is for each to build its own format. if you only have one physical machine, i suggest running a virtual machine program and in there run the other OS. this can be done both ways (windows on linux and linux on windows).
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 5,151
Threads: 396
Joined: Sep 2016
Oct-29-2016, 12:39 PM
(This post was last modified: Oct-29-2016, 12:40 PM by metulburr.)
(Oct-29-2016, 06:38 AM)Skaperen Wrote: if you only have one physical machine, i suggest running a virtual machine program and in there run the other OS. this can be done both ways (windows on linux and linux on windows). Ive had problems in the past using this method (specifically with py2exe on a windows virutal machine running in linux). Its been so long i could not say why though. My fix was to dual boot windows/linux.
Recommended Tutorials:
Posts: 1,298
Threads: 38
Joined: Sep 2016
If you are working on a Windows machine and don't want to invest in a new linux machine, create virtual environments or make a dual boot system, there are online tools that will do the conversion for you (depending on the complexity of your program). Here is just one example: http://www.onlinecompiler.net/ . There are many others as well. I would be interested if this or another site proved satisfactory for your purpose.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Posts: 5,151
Threads: 396
Joined: Sep 2016
Oct-29-2016, 01:48 PM
(This post was last modified: Oct-29-2016, 01:50 PM by metulburr.)
(Oct-29-2016, 01:17 PM)sparkz_alot Wrote: don't want to invest in a new linux machine, At this point i have a few desktops and i no longer even hassle with dual booting. I keep newer machines for windows as i game on them, and older ones for linux. I snag old desktops from yard sales for next to nothing. Libraries are at this point giving away XP machines in place for newer. Old machines running XP and wiping it out with Arch Linux can be a nice fast running linux machine. Even better if a later system.
Recommended Tutorials:
Posts: 3,458
Threads: 101
Joined: Sep 2016
The newest version of Visual Studio Community has a ton of features, and is almost the same as the Pro version. I actually use the Community version every day at work. The old Express versions were mostly trash, stripped down versions of Pro that were barely usable, but Community is the real deal.
There's a pretty rad guy that streams daily his progress at building a video game from scratch in C, and he uses Visual Studio Community as his debugger/compiler (but not his editor... he uses emacs for that. ...and uses shell scripts for compiling. ...he's a pretty hardcore guy). Handmade Hero, for those interested.
Posts: 12,030
Threads: 485
Joined: Sep 2016
I'm with metluburr (In a LAN)
|