XCODE Noob, some tips on linking in a 3rd party lib to TGE?
by Dave Young · in Torque Game Engine · 11/20/2008 (12:07 pm) · 8 replies
Hey guys, I'm using an iMac on OS 10.5.5 with the latest DL of xcode. I'm great with win/visual studios but a complete xcode noob.
I'm porting my very custom TGE project to the mac. It uses 3rd party libs sqlite and libcurl.
I couldn't find a precompiled libcurl for the mac, so I downloaded the source and built it which was pretty easy. I was able to run a command line ./configure, and a make and a make install, but I can't find any 'release' libs that might have been created, like curllib.lib. In Windows I could compile the lib, it would show up in a /release folder and add some header files and a line in my project config. In xcode I have no idea where the file would have been compiled to, or how to add a 3rd party lib to my xcode project.
Could someone please tell me how to link in a lib into my tge xcode project? I also have to do this with sqlite.
I'm porting my very custom TGE project to the mac. It uses 3rd party libs sqlite and libcurl.
I couldn't find a precompiled libcurl for the mac, so I downloaded the source and built it which was pretty easy. I was able to run a command line ./configure, and a make and a make install, but I can't find any 'release' libs that might have been created, like curllib.lib. In Windows I could compile the lib, it would show up in a /release folder and add some header files and a line in my project config. In xcode I have no idea where the file would have been compiled to, or how to add a 3rd party lib to my xcode project.
Could someone please tell me how to link in a lib into my tge xcode project? I also have to do this with sqlite.
#2
When you did a make install it probably put it in /usr/local/lib - hopefully it didn't put it in /usr/lib.
You can confirm that it's there by opening the terminal and typing "ls /usr/local/lib" [or "ls /usr/lib"]. "ls" is the command to list the contents of the directory - kind of like "dir" in DOS. As Ronny mentioned, it won't have the .lib extension - it will either be .a or .dylib.
Oh and I just checked /usr/lib on my 10.5.5 and I do indeed have libcurl. So it's installed by default...
11/21/2008 (5:47 am)
@Dave:When you did a make install it probably put it in /usr/local/lib - hopefully it didn't put it in /usr/lib.
You can confirm that it's there by opening the terminal and typing "ls /usr/local/lib" [or "ls /usr/lib"]. "ls" is the command to list the contents of the directory - kind of like "dir" in DOS. As Ronny mentioned, it won't have the .lib extension - it will either be .a or .dylib.
Oh and I just checked /usr/lib on my 10.5.5 and I do indeed have libcurl. So it's installed by default...
#3
11/21/2008 (5:49 am)
BTW libsqlite3 is also installed as part of Mac OS X 10.5.
#4
11/21/2008 (6:00 am)
OK, that may help, do I also need to do something to point headers there? I used to need to do something similar in win32/vstudios
#5
Line Location simCurl.cc:21: error: type specifier omitted for parameter 'size_t'
Line Location simCurl.cc:21: error: parse error before ',' token
Line Location simCurl.cc:22: error: no 'size_t SimCurl::write_data(...)' member function declared in class 'SimCurl'
Line Location simCurl.cc:23: error: 'up' undeclared (first use this function)
Line Location simCurl.cc:38: error: parse error before '=' token
Line Location simCurl.cc:38: error: 'size_t' undeclared (first use this function)
Line Location simCurl.cc:39: error: 'sz' undeclared (first use this function)
Line Location simCurl.cc:41: error: parse error before '=' token
Line Location simCurl.cc:43: error: 'nsz' undeclared (first use this function)
Line Location simCurl.cc:55: error: 'size' undeclared (first use this function)
Line Location simCurl.cc:55: error: 'nmemb' undeclared (first use this function)
Line Location simCurl.cc:55: error: 'buffer' undeclared (first use this function)
Line Location simCurl.cc:60: error: syntax error before '::' token
Line Location simCurl.cc:63: error: 'simcurl' was not declared in this scope
Line Location simCurl.cc:65: error: syntax error before '->' token
Line Location simCurl.cc:212: error: 'int SimCurl::progress_callback(void*, double, double, double, double)' and 'static int SimCurl::progress_callback(void*, double, double, double, double)' cannot be overloaded
Line Location simCurl.cc:212: error: no 'int SimCurl::progress_callback(void*, double, double, double, double)' member function declared in class 'SimCurl'
Line Location simCurl.cc:314: error: 'read_data' undeclared (first use this function)
Line Location simCurl.cc:316: error: 'CURLOPT_INFILESIZE_LARGE' undeclared (first use this function)
Line Location simCurl.cc:320: error: 'write_data' undeclared (first use this function)
Line Location simCurl.cc:334: error: 'class SimCurl' has no member named 'progress_callback'
Line Location simCurl.cc:352: error: 'CURLINFO_RESPONSE_CODE' undeclared (first use this function)
Line Location simCurl.h:42: error: parse error before '(' token
Line Location simCurl.h:43: error: parse error before '(' token
Line Location simCurl.h:43: error: duplicate member 'SimCurl::size_t'
11/21/2008 (6:13 am)
The reason I ask is because xcode gives various compile errors which makes me think some include file is not being picked up.Line Location simCurl.cc:21: error: type specifier omitted for parameter 'size_t'
Line Location simCurl.cc:21: error: parse error before ',' token
Line Location simCurl.cc:22: error: no 'size_t SimCurl::write_data(...)' member function declared in class 'SimCurl'
Line Location simCurl.cc:23: error: 'up' undeclared (first use this function)
Line Location simCurl.cc:38: error: parse error before '=' token
Line Location simCurl.cc:38: error: 'size_t' undeclared (first use this function)
Line Location simCurl.cc:39: error: 'sz' undeclared (first use this function)
Line Location simCurl.cc:41: error: parse error before '=' token
Line Location simCurl.cc:43: error: 'nsz' undeclared (first use this function)
Line Location simCurl.cc:55: error: 'size' undeclared (first use this function)
Line Location simCurl.cc:55: error: 'nmemb' undeclared (first use this function)
Line Location simCurl.cc:55: error: 'buffer' undeclared (first use this function)
Line Location simCurl.cc:60: error: syntax error before '::' token
Line Location simCurl.cc:63: error: 'simcurl' was not declared in this scope
Line Location simCurl.cc:65: error: syntax error before '->' token
Line Location simCurl.cc:212: error: 'int SimCurl::progress_callback(void*, double, double, double, double)' and 'static int SimCurl::progress_callback(void*, double, double, double, double)' cannot be overloaded
Line Location simCurl.cc:212: error: no 'int SimCurl::progress_callback(void*, double, double, double, double)' member function declared in class 'SimCurl'
Line Location simCurl.cc:314: error: 'read_data' undeclared (first use this function)
Line Location simCurl.cc:316: error: 'CURLOPT_INFILESIZE_LARGE' undeclared (first use this function)
Line Location simCurl.cc:320: error: 'write_data' undeclared (first use this function)
Line Location simCurl.cc:334: error: 'class SimCurl' has no member named 'progress_callback'
Line Location simCurl.cc:352: error: 'CURLINFO_RESPONSE_CODE' undeclared (first use this function)
Line Location simCurl.h:42: error: parse error before '(' token
Line Location simCurl.h:43: error: parse error before '(' token
Line Location simCurl.h:43: error: duplicate member 'SimCurl::size_t'
#6
The file includes this for the header, is this the proper syntax for xcode?
#include
BTW, I'm trying to port this specific resource:
www.garagegames.com/mg/forums/result.thread.php?qt=69365
If I can get this crossplatform I will be writing up a nice autopatcher resource which has worked great in TGE.
11/21/2008 (6:21 am)
Add:The file includes this for the header, is this the proper syntax for xcode?
#include
BTW, I'm trying to port this specific resource:
www.garagegames.com/mg/forums/result.thread.php?qt=69365
If I can get this crossplatform I will be writing up a nice autopatcher resource which has worked great in TGE.
#7
11/21/2008 (7:11 am)
That include is correct, but you're missing [at least] the declaration of size_t which is in stddef.h, so try adding #include
#8
Adding it before all the other includes eradicated the compile errors! On to sqlite.
THANKS!!
11/21/2008 (7:48 am)
Good call andy, it looks like most if not all of the errors are related to the fact that it can't resolve size_t.Adding it before all the other includes eradicated the compile errors! On to sqlite.
THANKS!!
Torque 3D Owner Ronny Bangsund
Torque Cheerleaders
Uisng the command line tool curl-config with flags "--libs" says I need the linker flags "-lcurl -lssl -lcrypto -lz". Open the project info and enter those in "Other linker flags". This worked for me on a test project I just built in XCode 3.1.
Unix-like dynamic libraries (.dylib on Mac, .so on Linux) contain just enough information to link with, so you don't need to go looking for .lib files.