Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > undefined reference

Reply
Thread Tools

undefined reference

 
 
gert
Guest
Posts: n/a
 
      02-09-2007
Does anyone develop fcgi aplicatioins ?

gert@gert:~/Desktop/svn/Cgi$ gcc -o bin obj.c
/tmp/ccTRfdlo.o: In function `main':
obj.c.text+0x99): undefined reference to `FCGI_printf'
obj.c.text+0x9e): undefined reference to `FCGI_Accept'
collect2: ld returned 1 exit status
gert@gert:~/Desktop/svn/Cgi$

 
Reply With Quote
 
 
 
 
gert
Guest
Posts: n/a
 
      02-09-2007
On Feb 10, 12:13 am, "gert" <(E-Mail Removed)> wrote:
> Does anyone develop fcgi aplicatioins ?
>
> gert@gert:~/Desktop/svn/Cgi$ gcc -o bin obj.c
> /tmp/ccTRfdlo.o: In function `main':
> obj.c.text+0x99): undefined reference to `FCGI_printf'
> obj.c.text+0x9e): undefined reference to `FCGI_Accept'
> collect2: ld returned 1 exit status
> gert@gert:~/Desktop/svn/Cgi$


forgot to add the source code

#include <fcgi_stdio.h>
#include <stdlib.h>

typedef struct self{
int value;
int (*add)(struct self*,int);
} obj;

int add(obj* this, int val) {
this->value = val;
return this->value;
}

obj* Obj(void){
obj* new = malloc(sizeof *new);
new->value = 0;
new->add = add;
return new;
}

int main (int argc, char** argv){
obj* myobj=Obj();
myobj->add(myobj,7);
while (FCGI_Accept() >= 0) {
printf("Content-type: text/html\r\n"
"\r\n"
"<title>FastCGI Hello! (C, fcgi_stdio library)</title>"
"<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>"
"Request number %d running on host <i>%s</i>\n",
myobj->value, getenv("SERVER_HOSTNAME"));
}
return 0;
}

 
Reply With Quote
 
 
 
 
artifact.one@googlemail.com
Guest
Posts: n/a
 
      02-09-2007
On Feb 9, 11:22 pm, "gert" <(E-Mail Removed)> wrote:
> On Feb 10, 12:13 am, "gert" <(E-Mail Removed)> wrote:
>
> > Does anyone develop fcgi aplicatioins ?

>
> > gert@gert:~/Desktop/svn/Cgi$ gcc -o bin obj.c
> > /tmp/ccTRfdlo.o: In function `main':
> > obj.c.text+0x99): undefined reference to `FCGI_printf'
> > obj.c.text+0x9e): undefined reference to `FCGI_Accept'
> > collect2: ld returned 1 exit status
> > gert@gert:~/Desktop/svn/Cgi$

>
> forgot to add the source code
>
> #include <fcgi_stdio.h>
> #include <stdlib.h>
>
> typedef struct self{
> int value;
> int (*add)(struct self*,int);
>
> } obj;
>
> int add(obj* this, int val) {
> this->value = val;
> return this->value;
>
> }
>
> obj* Obj(void){
> obj* new = malloc(sizeof *new);
> new->value = 0;
> new->add = add;
> return new;
>
> }
>
> int main (int argc, char** argv){
> obj* myobj=Obj();
> myobj->add(myobj,7);
> while (FCGI_Accept() >= 0) {
> printf("Content-type: text/html\r\n"
> "\r\n"
> "<title>FastCGI Hello! (C, fcgi_stdio library)</title>"
> "<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>"
> "Request number %d running on host <i>%s</i>\n",
> myobj->value, getenv("SERVER_HOSTNAME"));
> }
> return 0;
>
> }


OT, but add -L/path/containing/libfcgi.so -lfcgi.

MC

 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      02-10-2007
On 9 Feb 2007 15:13:14 -0800, in comp.lang.c , "gert"
<(E-Mail Removed)> wrote:

>Does anyone develop fcgi aplicatioins ?
>
>gert@gert:~/Desktop/svn/Cgi$ gcc -o bin obj.c
>/tmp/ccTRfdlo.o: In function `main':
>obj.c.text+0x99): undefined reference to `FCGI_printf'
>obj.c.text+0x9e): undefined reference to `FCGI_Accept'
>collect2: ld returned 1 exit status
>gert@gert:~/Desktop/svn/Cgi$


Even without the source code, this is detectable as FAQ 10.10b.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
Reply With Quote
 
gert
Guest
Posts: n/a
 
      02-11-2007
On Feb 10, 7:56 pm, Mark McIntyre <(E-Mail Removed)> wrote:
> Even without the source code, this is detectable as FAQ 10.10b.
>


Where can i find the faq ?


 
Reply With Quote
 
gert
Guest
Posts: n/a
 
      02-11-2007
On Feb 11, 1:42 am, "gert" <(E-Mail Removed)> wrote:
> On Feb 10, 7:56 pm, Mark McIntyre <(E-Mail Removed)> wrote:
>
> > Even without the source code, this is detectable as FAQ 10.10b.

>
> Where can i find the faq ?


Never mind i found the faq but i still dont understand how to fix the
problem ?


 
Reply With Quote
 
Christopher Layne
Guest
Posts: n/a
 
      02-11-2007
gert wrote:

>> Where can i find the faq ?

>
> Never mind i found the faq but i still dont understand how to fix the
> problem ?


http://en.wikipedia.org/wiki/Library_(computer_science)
 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      02-11-2007
On 10 Feb 2007 16:52:46 -0800, in comp.lang.c , "gert"
<(E-Mail Removed)> wrote:

>On Feb 11, 1:42 am, "gert" <(E-Mail Removed)> wrote:
>> On Feb 10, 7:56 pm, Mark McIntyre <(E-Mail Removed)> wrote:
>>
>> > Even without the source code, this is detectable as FAQ 10.10b.

>>
>> Where can i find the faq ?

>
>Never mind i found the faq but i still dont understand how to fix the
>problem ?
>


If you read the FAQ, it explains what the problem is - you need to
link against the right libraries. How you do this is system-specific
and you need to RTFM for your toolset, and/or ask in a specialist
group. Hint: find out what the -l ( minus ell) flag does.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
Reply With Quote
 
gert
Guest
Posts: n/a
 
      02-11-2007
Alelooia

gcc -L/usr/lib/libfcgi.so -lfcgi -o Desktop/svn/db/cgi/header.cgi
Desktop/svn/db/cgi/header.c

And No i have no idea why it compiles or what the difference is
between the big -L and the small -l

I am just a little frustrated trying the hole weekend to display hello
world om my browser

If only my lighttpd webserver would now be nice enough to finaly run
my cgi i would be happy.

 
Reply With Quote
 
gert
Guest
Posts: n/a
 
      02-11-2007
On Feb 11, 7:18 pm, "gert" <(E-Mail Removed)> wrote:
> Alelooia
>
> gcc -L/usr/lib/libfcgi.so -lfcgi -o Desktop/svn/db/cgi/header.cgi
> Desktop/svn/db/cgi/header.c
>
> And No i have no idea why it compiles or what the difference is
> between the big -L and the small -l
>
> I am just a little frustrated trying the hole weekend to display hello
> world om my browser
>
> If only my lighttpd webserver would now be nice enough to finaly run
> my cgi i would be happy.


WHAAAAAAAAAAAAA going postal

/home/gert/Desktop/svn/db/cgi/header.cgi: error while loading shared
libraries: libfcgi.so.0: cannot open shared object file: No such file
or directory

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
typeof x == 'undefined' or x == undefined? -Lost Javascript 13 01-31-2007 12:04 AM
undefined vs. undefined (was: new Array() vs []) VK Javascript 45 09-12-2006 05:26 PM
'Undefined' Client-Side Object Reference Felipe ASP .Net 3 07-16-2004 04:01 AM
undefined behavior or not undefined behavior? That is the question Mantorok Redgormor C Programming 70 02-17-2004 02:46 PM
Error: 'undefined reference' in g++ but gcc succeeded Lu C++ 1 07-10-2003 12:55 PM



Advertisments