ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

Compiling C Help



  Black Gold Cup Packed 182
Ive got some c files that I need to compile, but I'm having trouble with it. Is there anyone here who's handy with programming that could try to do it for me if I send them the files.

Muchos Gracias
 

sbridgey

ClioSport Club Member
  disco 4, 182, Meglio
Is your compiler throwing errors or do you just not have access to one?
 
  Black Gold Cup Packed 182
I'm trying to compile through terminal, I'm getting mysql.h not found, even when I point it to the correct directories
 
  Black Gold Cup Packed 182
I'm trying to compile on osx through terminal. I don't know if it needs to be compile on windows or Linux, or even if it matters. Was hoping someone in the know would be willing to take a look for me.
 
  182 Trophy
The default mysql install won't have the correct headers AFAIK.

Get homebrew or Mac ports and install mysql through one of those, then you should be good!
 
  Black Gold Cup Packed 182
I downloaded mysql c connector and moved the files to /usr/lib/ but still no joy. I also tried using Xcode got it to find headers but then got other errors, undefined symbols for architecture. Errors for all architectures. I386 x86 64bit etc
 
  Black Gold Cup Packed 182
To configure:

core_sql.c (fallback logins)
mypa.cfg (logins)

then type make all ...

To call it in game: run tick.sh in the background, it
calls the ticker every 30 s.

You need to run tick.sh locally
----------------

That's the documentation.

http://retroapp.co.uk/pa/ticker/

And that's the files.
 
  Black Gold Cup Packed 182
It's a web based game written in php, I've got the database and php files up and working. Just needs the ticker to make the game tick every 30secs. It's old code, ~10yrs old
 
  182/RS2/ Turbo/Mk1
Not really something I can look at on my phone, lol.

Is the directory that you copied the mysql.h file into definately one of the paths for the compiler?


And what do you mean its written in php? You just said it was S and you are talking about .h files?
 
  182 Trophy
Its a PHP game that has an updater written in C that runs every 30 seconds.

If I get some free time later, I can have a crack at compiling it.
 
  Black Gold Cup Packed 182
Your welcome to have a look mate, the more the merrier :) it's mainly for nostalgic reasons
 

sn00p

ClioSport Club Member
  A blue one.
Requires a bit of tinkering under OS X.

I can get it to compile after modifying the makefile to point to the correct include and lib folders and source files to remove the mysql prefix from the mysql includes, but OS X is missing libcrypt so it won't link and I can't be arsed to find a working libcrypt which seems to be deprecated (although I didn't search very hard).

Edit:

Scratch that, seems libcrypto is compatible.

this is my makefile:

You also need to replace all occurences of the #include <mysql/mysql.h> with #include <mysql.h>

Oh and note the path to mysql, that'll need to match the path where you have mysql installed.

Code:
#
# MyPHPpa ticker
# Copyright (C) 2003 Jens Beyer
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#


LIB =    -L/usr/local/mysql-5.6.16-osx10.7-x86_64/lib -lmysqlclient -lcrypto -lz
SRC =    ticker.c score.c update.c core_sql.c helper.c battle.c cleanup.c logging.c
OBJ =    $(SRC:.c=.o)
INC =    -I /usr/local/mysql-5.6.16-osx10.7-x86_64/include


CC =    gcc
CFLAGS=    -O3 -g -Wall $(INC) $(LIB)
LDFLAGS= -O3 $(LIB)


.SUFFIXES: .c .o


.PHONY: update


all:    ticker tick_sleep


test:    $(OBJ)
    gcc -O -g $(OBJ) -o ticker.test $(LIB)


ticker:    $(OBJ)
    gcc -O -g $(OBJ) -o ticker $(LIB) 


sql:    test_sql.o core_sql.o
    gcc -O -g test_sql.o core_sql.o -o test_sql $(LIB)


tick_sleep: tick_sleep.o
    gcc -O -g tick_sleep.o -o tick_sleep


update:    
    cp ticker ticker.old
    cp ticker.test ticker


clean:    
    rm -f *.o ticker *~ tick_sleep


$(OBJ): ticker.h logging.h
tick_sleep.o:    tick_sleep.c
 
Last edited:
  Black Gold Cup Packed 182
I still get this error.

ticker.c:28:10: fatal error: 'mysql.h' file not found

I really appreciate your help mate.
 
  Black Gold Cup Packed 182
Somebody else on another forum compiled it on leopard and gave me all the steps. Still get the missing header file error after following all the steps. It's giving me piles. It must be something I'm doing wrong.
 
  Black Gold Cup Packed 182
I managed to get it to compile by changing the #define <mysql.h> to the full directory in every instance.

However, new problem, yay.

Is there a way to modify the makefile to make a 64bit binary?
 

sn00p

ClioSport Club Member
  A blue one.
Not entirely sure why you'd want it as a 64 bit binary.....but......add -arch x84_64 to the CFLAGS in the makefile.

You obviously didn't have the right path added to the Makefile for the include search folder if "#include <mysql.h>" didn't work.
 


Top