Sinisterly
cmd doesn't compile and run C code - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: C, C++, & Obj-C (https://sinister.li/Forum-C-C-Obj-C)
+--- Thread: cmd doesn't compile and run C code (/Thread-cmd-doesn-t-compile-and-run-C-code)

Pages: 1 2 3 4 5 6


RE: cmd doesn't compile and run C code - Daedalus - 11-24-2013

(11-24-2013, 06:52 PM)Geo777 Wrote:
(11-24-2013, 06:41 PM)Knee-O Wrote: Please list each command you are entering and I'll try to see if you're doing anything wrong.

I type in cmd : gcc name.c -o example && example and then enter. After this , commander compiles and runs the program...
After doing a quick Google search, it seems the main cause of this problem is if you already have a copy of 'example.exe' running. Open up your task manager, go to processes, and check to see if 'example.exe' is running. If it is, close it and try running your program again.

If that doesn't work, then you might have issues with folder permissions. Do as Slarek suggested and try moving the file to a different folder, such as My Documents. Also see if opening command prompt in administrator mode helps.


RE: cmd doesn't compile and run C code - Daedalus - 11-24-2013

(11-24-2013, 06:52 PM)Geo777 Wrote:
(11-24-2013, 06:41 PM)Knee-O Wrote: Please list each command you are entering and I'll try to see if you're doing anything wrong.

I type in cmd : gcc name.c -o example && example and then enter. After this , commander compiles and runs the program...
After doing a quick Google search, it seems the main cause of this problem is if you already have a copy of 'example.exe' running. Open up your task manager, go to processes, and check to see if 'example.exe' is running. If it is, close it and try running your program again.

If that doesn't work, then you might have issues with folder permissions. Do as Slarek suggested and try moving the file to a different folder, such as My Documents. Also see if opening command prompt in administrator mode helps.


RE: cmd doesn't compile and run C code - Geo777 - 11-24-2013

(11-24-2013, 06:58 PM)Slarek Wrote: Where you have saved your files?
Try to change the directory.

I've saved them in an usual file folder.

(11-24-2013, 07:02 PM)Knee-O Wrote:
(11-24-2013, 06:52 PM)Geo777 Wrote:
(11-24-2013, 06:41 PM)Knee-O Wrote: Please list each command you are entering and I'll try to see if you're doing anything wrong.

I type in cmd : gcc name.c -o example && example and then enter. After this , commander compiles and runs the program...
After doing a quick Google search, it seems the main cause of this problem is if you already have a copy of 'example.exe' running. Open up your task manager, go to processes, and check to see if 'example.exe' is running. If it is, close it and try running your program again.

If that doesn't work, then you might have issues with folder permissions. Do as Slarek suggested and try moving the file to a different folder, such as My Documents. Also see if opening command prompt in administrator mode helps.


Really , I saw 2-3 copies of the program


RE: cmd doesn't compile and run C code - Geo777 - 11-24-2013

(11-24-2013, 06:58 PM)Slarek Wrote: Where you have saved your files?
Try to change the directory.

I've saved them in an usual file folder.

(11-24-2013, 07:02 PM)Knee-O Wrote:
(11-24-2013, 06:52 PM)Geo777 Wrote:
(11-24-2013, 06:41 PM)Knee-O Wrote: Please list each command you are entering and I'll try to see if you're doing anything wrong.

I type in cmd : gcc name.c -o example && example and then enter. After this , commander compiles and runs the program...
After doing a quick Google search, it seems the main cause of this problem is if you already have a copy of 'example.exe' running. Open up your task manager, go to processes, and check to see if 'example.exe' is running. If it is, close it and try running your program again.

If that doesn't work, then you might have issues with folder permissions. Do as Slarek suggested and try moving the file to a different folder, such as My Documents. Also see if opening command prompt in administrator mode helps.


Really , I saw 2-3 copies of the program


RE: cmd doesn't compile and run C code - gBarreras - 11-24-2013

These simple C programs found in Internet are generally writen and compiled in Linux.
So be careful, because since your Windows compiler may not be not the same as Linux', your programs behavior can be different from the original example you found.
Besides, some libraries are Windows-exclusive or Linux-exclusive: winsock.h and socket.h for instance.


RE: cmd doesn't compile and run C code - gBarreras - 11-24-2013

These simple C programs found in Internet are generally writen and compiled in Linux.
So be careful, because since your Windows compiler may not be not the same as Linux', your programs behavior can be different from the original example you found.
Besides, some libraries are Windows-exclusive or Linux-exclusive: winsock.h and socket.h for instance.


RE: cmd doesn't compile and run C code - Geo777 - 11-25-2013

(11-24-2013, 11:14 PM)gBarreras Wrote: These simple C programs found in Internet are generally writen and compiled in Linux.
So be careful, because since your Windows compiler may not be not the same as Linux', your programs behavior can be different from the original example you found.
Besides, some libraries are Windows-exclusive or Linux-exclusive: winsock.h and socket.h for instance.

Now , I am using windows but I am going to install linux through the internet. As I know it's safe. Probably it will help me to solve this kinds of problems.


RE: cmd doesn't compile and run C code - Geo777 - 11-25-2013

(11-24-2013, 11:14 PM)gBarreras Wrote: These simple C programs found in Internet are generally writen and compiled in Linux.
So be careful, because since your Windows compiler may not be not the same as Linux', your programs behavior can be different from the original example you found.
Besides, some libraries are Windows-exclusive or Linux-exclusive: winsock.h and socket.h for instance.

Now , I am using windows but I am going to install linux through the internet. As I know it's safe. Probably it will help me to solve this kinds of problems.


RE: cmd doesn't compile and run C code - gBarreras - 11-25-2013

(11-25-2013, 01:53 PM)Geo777 Wrote:
(11-24-2013, 11:14 PM)gBarreras Wrote: These simple C programs found in Internet are generally writen and compiled in Linux.
So be careful, because since your Windows compiler may not be not the same as Linux', your programs behavior can be different from the original example you found.
Besides, some libraries are Windows-exclusive or Linux-exclusive: winsock.h and socket.h for instance.

Now , I am using windows but I am going to install linux through the internet. As I know it's safe. Probably it will help me to solve this kinds of problems.
I recommend you to download VirtualBox and run any Linux distribution there. You can find easy tutorials in the web about that.
VirtualBox is a virtual machine. It allows you to run any OS you own within your Windows OS.
Cheers!


RE: cmd doesn't compile and run C code - gBarreras - 11-25-2013

(11-25-2013, 01:53 PM)Geo777 Wrote:
(11-24-2013, 11:14 PM)gBarreras Wrote: These simple C programs found in Internet are generally writen and compiled in Linux.
So be careful, because since your Windows compiler may not be not the same as Linux', your programs behavior can be different from the original example you found.
Besides, some libraries are Windows-exclusive or Linux-exclusive: winsock.h and socket.h for instance.

Now , I am using windows but I am going to install linux through the internet. As I know it's safe. Probably it will help me to solve this kinds of problems.
I recommend you to download VirtualBox and run any Linux distribution there. You can find easy tutorials in the web about that.
VirtualBox is a virtual machine. It allows you to run any OS you own within your Windows OS.
Cheers!