## How do I compile C?

For general discussion about Conway's Game of Life.
Saka
Posts: 3180
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X
Contact:

### 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

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

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

### Re: How do I compile C?

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

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

Sokwe
Moderator
Posts: 1630
Joined: July 9th, 2009, 2:44 pm

### 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

Scorbie
Posts: 1445
Joined: December 7th, 2013, 1:05 am

### 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

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

### 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...

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

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

### Re: How do I compile C?

I tried the example on the thread and it does nothing, I'm confused

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

Scorbie
Posts: 1445
Joined: December 7th, 2013, 1:05 am

### 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

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

### 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)?

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

dvgrn
Moderator
Posts: 6439
Joined: May 17th, 2009, 11:00 pm
Contact:

### 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:

Code: Select all

``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.

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

### Re: How do I compile C?

@dvgrn
Does input.txt and output.txt have to be in the same folder as dr2?

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

Scorbie
Posts: 1445
Joined: December 7th, 2013, 1:05 am

### 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:

Code: Select all

``````drifter_directory
ㄴdr
ㄴinput.txt
ㄴoutput.txt

You may want to run:
dr < input.txt > output.txt
(You're on windows, right?)
``````
The files needn't be in the same directory:

Code: Select all

``````drifter_directory
ㄴdr
ㄴfiles
ㄴinput.txt
ㄴoutput.txt

You 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.)
``````

Code: Select all

``````some_directory
ㄴdrifter_directory
ㄴdr
ㄴinput.txt
ㄴsome_other_directory
ㄴoutput.txt

You 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:

Code: Select all

``````drifter_directory
ㄴdr
...Completely Unrelated...
C:
ㄴUsers
ㄴSaka
ㄴsome_folder
ㄴinput.txt

You 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

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

### 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

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

Scorbie
Posts: 1445
Joined: December 7th, 2013, 1:05 am

### 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

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

### 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"

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

Scorbie
Posts: 1445
Joined: December 7th, 2013, 1:05 am

### Re: How do I compile C?

You can set the executable name. If you do

Code: Select all

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

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

### Re: How do I compile C?

You typed drifrter

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

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

### Re: How do I compile C?

Help!
When I did dr < input.txt > output.txt
it said

Code: Select all

``Bad bit in 'd' or 'D' command``
same output for dr2
I was trying the example inputs on the thread

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

Scorbie
Posts: 1445
Joined: December 7th, 2013, 1:05 am

### 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

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

### 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:

Code: Select all

``````c50
h15
w15
rot90symm
v127 1
d2 36 36 44 44
r36 36
444344o.4
....o.o.4
oooo.oo.4
4.o...o.3
4o.....o4
3.o...o.4
4.oo.oooo
4.o.o....
4.o443444!
d0 37 36 37 39
d0 38 36 38 38
d0 p39 37
skipstable
skipfizzle
``````
2. Made output.txt in same folder as dr2
3.Opened dr2.exe
4.Ran

Code: Select all

``dr2 < input.txt > output.txt``
5. Got the message
Did I do something wrong? Maybe we can compare our steps

Code: Select all

``````x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o\$11b4obo\$2bob3o2bo2b3o\$bo3b2o4b2o\$o2bo2bob2o3b4o\$bob2obo5b
o2b2o\$2b2o4bobo2b3o\$bo3b5ob2obobo\$2bo5bob2o\$4bob2o2bobobo!
``````
(Check gen 2)

Scorbie
Posts: 1445
Joined: December 7th, 2013, 1:05 am

### 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