## How do I compile C?

For general discussion about Conway's Game of Life.

### How do I compile C?

How do I compile C code? What programs can I use? I would really like to use dr soon and gfind
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

I have Cygwin and Micro C compiler (mcc) but I cannot compile dr
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

Saka wrote:I have Cygwin and Micro C compiler (mcc) but I cannot compile dr

There should be no need to compile dr under Cygwin. Since you are using Windows, I think you should get MinGW and compile dr using the GCC compiler.

I included a Windows executable for dr2 in this post (and forgot to include the source code, which is here). Does this executable not work for you?
-Matthias Merzenich
Sokwe
Moderator

Posts: 1334
Joined: July 9th, 2009, 2:44 pm

### Re: How do I compile C?

Sokwe wrote:There should be no need to compile dr under Cygwin. Since you are using Windows, I think you should get MinGW and compile dr using the GCC compiler.
I know Cygwin is overkill for source compilations like these but much of the Windows ConwayLife users would have Cygwin installed anyway because of compiling apgnano. Personally I do not like it too much as it can be kinda bloated and they say it's slower... but I guess windows users would have to stick with that.
Best wishes to you, Scorbie

Scorbie

Posts: 1367
Joined: December 7th, 2013, 1:05 am

### Re: How do I compile C?

Sokwe wrote:
Saka wrote:I have Cygwin and Micro C compiler (mcc) but I cannot compile dr

There should be no need to compile dr under Cygwin. Since you are using Windows, I think you should get MinGW and compile dr using the GCC compiler.

I included a Windows executable for dr2 in this post (and forgot to include the source code, which is here). Does this executable not work for you?
Thanks! Didn't see that post...
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

I tried the example on the thread and it does nothing, I'm confused
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

Saka wrote:I tried the example on the thread and it does nothing, I'm confused
Keep calm and read on: viewtopic.php?f=9&t=1445#p16606
Best wishes to you, Scorbie

Scorbie

Posts: 1367
Joined: December 7th, 2013, 1:05 am

### Re: How do I compile C?

Scorbie wrote:
Saka wrote:I tried the example on the thread and it does nothing, I'm confused
Keep calm and read on: viewtopic.php?f=9&t=1445#p16606

I did read that, but I am not sure what it meant, so, in dr, do I input
dr2 > output.txt
And then
dr2 < input.txt
(Or vice versa)?
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

Saka wrote:
Scorbie wrote:
Saka wrote:I tried the example on the thread and it does nothing, I'm confused
Keep calm and read on: viewtopic.php?f=9&t=1445#p16606

I did read that, but I am not sure what it meant, so, in dr, do I input
dr2 > output.txt
And then
dr2 < input.txt
(Or vice versa)?

Both:

`dr2 < input.txt > output.txt`

Or at least the second one. Otherwise dr2 won't have any input. Piping the output to a file is optional -- if you don't add the "> output.txt", you'll just see all the output in the command window, and if you want to save it you'd have to copy it from there.

The key idea is that two separate steps definitely wouldn't work -- dr2 isn't going to save any state from one run to the next. Each time you run it, it has to have all the information it needs to run a search and send the results wherever you want them to be stored.

dvgrn
Moderator

Posts: 4980
Joined: May 17th, 2009, 11:00 pm

### Re: How do I compile C?

@dvgrn
Does input.txt and output.txt have to be in the same folder as dr2?
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

Saka wrote:@dvgrn Does input.txt and output.txt have to be in the same folder as dr2?
Umm... Sort of. I guess you tested that. If not, a short test would have let you know.
(I originally tried to suggest a keyword to search on Google but umm... it's hard to describe this "thing".)

Here are some examples:
`drifter_directoryㄴdrㄴinput.txtㄴoutput.txtYou may want to run:dr < input.txt > output.txt(You're on windows, right?)`

The files needn't be in the same directory:
`drifter_directoryㄴdrㄴfiles  ㄴinput.txt  ㄴoutput.txtYou may want to run:dr < files/input.txt > files/output.txt (The cmd line is in the drifter_directory.)or maybe:../dr < input.txt > output.txt (The cmd prompt is in the files directory.)`

`some_directoryㄴdrifter_directory  ㄴdrㄴinput.txtㄴsome_other_directory  ㄴoutput.txtYou may want to run:dr < ../input.txt > ../some_other_directory/output.txt(.. means the parent directory. I haven't tested this on Windows but I think it would work.)`

Or even:
`drifter_directoryㄴdr...Completely Unrelated...C:ㄴUsers  ㄴSaka    ㄴsome_folder      ㄴinput.txtYou can run:dr < C:\Users\Saka\some_folder\input.txt (cmd prompt is in the drifter_directory)`

1)The last one is related to "absolute path", the others are related to "relative path". Recommend to search on Google to understand how that works.
2) About the backslashes: Windows works both with forward slashes and backslashes as a subdirectory "sign". I don't know the minor quirks of it, though.
3) You can drag a file to the command prompt to list its absolute path.

Tip: When asking questions, generally, I think it would save your time (and my time ) if you specified what you tried, or things like that, more specifically. [+ Your Computer OS, Program, stacktraces etc. if something crashed] I think you would have solved the problem faster if you initially posted what you posted two posts later.
I didn't mean any offense, though... Just pointing out that this would help in getting answers to questions faster.
Last edited by Scorbie on December 18th, 2015, 9:34 am, edited 1 time in total.
Best wishes to you, Scorbie

Scorbie

Posts: 1367
Joined: December 7th, 2013, 1:05 am

### Re: How do I compile C?

OMG YOU GUESSED MY PC USERNAME!!(Not sure which emoticon to put)
I have not tried that out, because it's already late night
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

Saka wrote:OMG YOU GUESSED MY PC USERNAME!!(Not sure which emoticon to put)
LOL guess what my username is
Saka wrote:I have not tried that out, because it's already late night
Best wishes to you, Scorbie

Scorbie

Posts: 1367
Joined: December 7th, 2013, 1:05 am

### Re: How do I compile C?

Scorbie wrote:
Saka wrote:OMG YOU GUESSED MY PC USERNAME!!(Not sure which emoticon to put)
LOL guess what my username is
Scorbie? Scorbic? Not sure. Also, in response to my post in the "New p17 and other billiard tables" thread, you posted the way to compile dr with cygwin, I did not understand what you meant by "your_binary_name"
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

You can set the executable name. If you do
`gcc -O3 dr.c -o drifter`
the executable name would be drifrter.exe.
Best wishes to you, Scorbie

Scorbie

Posts: 1367
Joined: December 7th, 2013, 1:05 am

### Re: How do I compile C?

You typed drifrter
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

Help!
When I did dr < input.txt > output.txt
it said
`Bad bit in 'd' or 'D' command`

same output for dr2
I was trying the example inputs on the thread
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

eek... I don't know what's wrong with that and I think the dr2 thread would be a better place for that (maybe there isn't a dr2 thread?)
Best wishes to you, Scorbie

Scorbie

Posts: 1367
Joined: December 7th, 2013, 1:05 am

### Re: How do I compile C?

Scorbie wrote:eek... I don't know what's wrong with that and I think the dr2 thread would be a better place for that (maybe there isn't a dr2 thread?)

Ok, I'll try to retrace:
`c50h15w15rot90symmv127 1d2 36 36 44 44r36 36444344o.4....o.o.4oooo.oo.44.o...o.34o.....o43.o...o.44.oo.oooo4.o.o....4.o443444!d0 37 36 37 39d0 38 36 38 38d0 p39 37skipstableskipfizzle`

2. Made output.txt in same folder as dr2
3.Opened dr2.exe
4.Ran
`dr2 < input.txt > output.txt`

5. Got the message
Did I do something wrong? Maybe we can compare our steps
Proud owner and founder of Sakagolue
`x = 17, y = 10, rule = B3/S23b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5bo2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!`

(Check gen 2)

Saka

Posts: 2577
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X

### Re: How do I compile C?

Saka, I think it is better to ask questions at each thread instead of opening a new onein the general discussions forum... You could always read the existing Bellman, drifter, or ptbsearch threads and post something you don't understand there.
Best wishes to you, Scorbie

Scorbie

Posts: 1367
Joined: December 7th, 2013, 1:05 am