Compiler error

M

M.Caggiano

I've write a function without errors but i've this message after
compilation:

*** ["../Socket/Client/Client.o"] Error1

how can i resolve this problem?
Many many thanks in advance.
 
F

Flash Gordon

M.Caggiano wrote, On 03/02/08 11:59:
I've write a function without errors but i've this message after
compilation:

*** ["../Socket/Client/Client.o"] Error1

how can i resolve this problem?
Many many thanks in advance.

The first thing to do is correct your assumption that the function is
without errors. You obviously have an error somewhere or you would not
get an error reported. Then consider how *anyone* is supposed to guess
what the problem is based on what you posted.
 
K

Kenny McCormack

M.Caggiano wrote, On 03/02/08 11:59:
I've write a function without errors but i've this message after
compilation:

*** ["../Socket/Client/Client.o"] Error1

how can i resolve this problem?
Many many thanks in advance.

The first thing to do is correct your assumption that the function is
without errors. You obviously have an error somewhere or you would not
get an error reported. Then consider how *anyone* is supposed to guess
what the problem is based on what you posted.

So helpful. So sweet. So kind.

Fine example of modern US civility. A beacon for us all.
 
M

Mark McIntyre

M.Caggiano said:
I've write a function without errors but i've this message after
compilation:

*** ["../Socket/Client/Client.o"] Error1

how can i resolve this problem?

Read the compiler / linker manual to find out what "error 1" is.
This looks more like a linker error, by the way - nothing to do with C.
 
H

Harald van Dijk

M.Caggiano said:
I've write a function without errors but i've this message after
compilation:

*** ["../Socket/Client/Client.o"] Error1

how can i resolve this problem?

Read the compiler / linker manual to find out what "error 1" is. This
looks more like a linker error, by the way - nothing to do with C.

Doesn't look like a linker error to me. It looks like there's an error
reported by make or a similar build tool in generating
.../Socket/Client/Client.o, which is typically the job of the compiler,
not the linker. I don't know why the OP didn't bother to post an actually
useful error message though.
 
M

M.Caggiano

M.Caggiano wrote, On 03/02/08 11:59:
I've write a function without errors but i've this message after
compilation:
*** ["../Socket/Client/Client.o"] Error1
how can i resolve this problem?
Many many thanks in advance.

The first thing to do is correct your assumption that the function is
without errors. You obviously have an error somewhere or you would not
get an error reported. Then consider how *anyone* is supposed to guess
what the problem is based on what you posted.

The only error of the function is that.
I don't know whether to also think because the message is enough
vague.
Thanks the same.
 
W

Walter Roberson

M.Caggiano said:
I've write a function without errors but i've this message after
compilation:
*** ["../Socket/Client/Client.o"] Error1
Read the compiler / linker manual to find out what "error 1" is. This
looks more like a linker error, by the way - nothing to do with C.
Doesn't look like a linker error to me. It looks like there's an error
reported by make or a similar build tool in generating
../Socket/Client/Client.o,

I would agree. "Error 1" is make's typical error report after
a problem in the previous step, whether that step be a compile or link.
It is what "make" reports for the majority of situations in which
the previous step returned a non-success error code. The actual
problem would have appeared above that.
 
R

Richard Heathfield

Mark McIntyre said:

This looks more like a linker error, by the way - nothing to do with C.

Linking is Translation Phase 8, a very important part of the translation
process for C programs. It is lots to do with C.
 
M

Mark McIntyre

Richard said:
Mark McIntyre said:



Linking is Translation Phase 8, a very important part of the translation
process for C programs. It is lots to do with C.

Read what I wrote more carefully.

While "linking" is something to do with C, the linker is not. The linker
is a language-neutral tool that performs the action of linking.
 
M

Mark McIntyre

Harald said:
M.Caggiano said:
I've write a function without errors but i've this message after
compilation:

*** ["../Socket/Client/Client.o"] Error1

how can i resolve this problem?
Read the compiler / linker manual to find out what "error 1" is. This
looks more like a linker error, by the way - nothing to do with C.

Doesn't look like a linker error to me. It looks like there's an error
reported by make or a similar build tool in generating

You may be right, but my crystal ball isn't up to devining anything
better than "user claims no bugs in C code, but still gets error,
possible error in the next step of creating an executable"...
../Socket/Client/Client.o, which is typically the job of the compiler,
not the linker.

it could equally well be a problem /reading/ that object in order to
link it. The OP removed all useful context...

I don't know why the OP didn't bother to post an actually
useful error message though.

I suspect its the usual reason - he snipped what he thought was
irrelevant but didn't know enough about the problem to get that snippage
right.

To the OP: post more detail...
 
K

Keith Thompson

Harald van Dijk said:
M.Caggiano said:
I've write a function without errors but i've this message after
compilation:

*** ["../Socket/Client/Client.o"] Error1

how can i resolve this problem?

Read the compiler / linker manual to find out what "error 1" is. This
looks more like a linker error, by the way - nothing to do with C.

Doesn't look like a linker error to me. It looks like there's an error
reported by make or a similar build tool in generating
../Socket/Client/Client.o, which is typically the job of the compiler,
not the linker. I don't know why the OP didn't bother to post an actually
useful error message though.

It's hard to tell, but most tools I've seen report the name of the
*input* file in an error message. If the error message referred to
"../Socket/Client/Client.c", I'd assume a compile-time error; given
the reference to "Client.o", it's probably a link-time error.

Though it's conceivable that there was an error *writing* Client.o.

(I'm also assuming that the ".o" suffix denotes an object file, the
output of the compiler; this is not 100% certain, but I think it's a
safe bet, especially given that the form of the path implies a
Unix-like system.)
 
K

Keith Thompson

M.Caggiano said:
I've write a function without errors but i've this message after
compilation:

*** ["../Socket/Client/Client.o"] Error1

how can i resolve this problem?
Many many thanks in advance.

First of all, it's important to copy-and-paste the *exact* error
message. Whatever tool produced the message, I suspect it actually
printed "Error 1", not "Error1". This may seem like a trivial point,
but we can't guess what other errors you may have inadvertently
produced when you re-typed the message.

As it happens, the form of the error message looks familiar; it
appears to be from the GNU "make" command, and it indicates that
*some* command, intended to create the file
"../Socket/Client/Client.o", failed with a status code of 1. Most
likely that command was the compiler. Normally you should have seen
the compiler's output just before the message you quoted. The most
likely explanations are (a) you've failed to show us the relevant
output (without which we can't possibly guess what the problem is), or
(b) the make command was invoked in such a way that it discarded the
compiler's diagnostic output (which would be an odd thing to do).

You seem to be assuming that you've written a function without errors;
since you're getting an error message, that seems unlikely. Look for
error messages from the compiler. Look at your Makefile and at the
way you're invoking the "make" command to be sure that it's letting
you see any messages from the compiler.

For help with using make, post to comp.unix.programmer. If you can
see the compiler's output, pay attention to the messages; if they
indicate a problem in your C source, and you have trouble correcting
it, post here with more details. If the problem has to do with a
system-specific feature, rather than with the core C language and
library, we might redirect you; in particular, sockets are not part of
standard C, and can be discussed in comp.unix.programmer.

You might also want to read this:
<http://www.catb.org/~esr/faqs/smart-questions.html>.
 
K

Keith Thompson

Keith Thompson said:
Harald van Dijk said:
M.Caggiano wrote:
I've write a function without errors but i've this message after
compilation:

*** ["../Socket/Client/Client.o"] Error1

how can i resolve this problem?

Read the compiler / linker manual to find out what "error 1" is. This
looks more like a linker error, by the way - nothing to do with C.

Doesn't look like a linker error to me. It looks like there's an error
reported by make or a similar build tool in generating
../Socket/Client/Client.o, which is typically the job of the compiler,
not the linker. I don't know why the OP didn't bother to post an actually
useful error message though.

It's hard to tell, but most tools I've seen report the name of the
*input* file in an error message. If the error message referred to
"../Socket/Client/Client.c", I'd assume a compile-time error; given
the reference to "Client.o", it's probably a link-time error.

It appears that I was mistaken. I realized after I wrote the above
that ``make'' *does* report the name of the output file in its error
messages. See my other followup for more details.
 
M

Morris Dovey

M.Caggiano said:
---ATTENTION---
Problem resolved boys!!
Thanks to everybody.
Now however I will open a new discussion from the title "Socket: bind
error...why??"

Excellent! Please tell us what the problem was and how you
resolved it.

would be a much better forum for
discussion of networking code.
 
M

M.Caggiano

M.Caggiano said:
I've write a function without errors but i've this message after
compilation:
*** ["../Socket/Client/Client.o"] Error1
how can i resolve this problem?
Many many thanks in advance.

First of all, it's important to copy-and-paste the *exact* error
message. Whatever tool produced the message, I suspect it actually
printed "Error 1", not "Error1". This may seem like a trivial point,
but we can't guess what other errors you may have inadvertently
produced when you re-typed the message.

As it happens, the form of the error message looks familiar; it
appears to be from the GNU "make" command, and it indicates that
*some* command, intended to create the file
"../Socket/Client/Client.o", failed with a status code of 1. Most
likely that command was the compiler. Normally you should have seen
the compiler's output just before the message you quoted. The most
likely explanations are (a) you've failed to show us the relevant
output (without which we can't possibly guess what the problem is), or
(b) the make command was invoked in such a way that it discarded the
compiler's diagnostic output (which would be an odd thing to do).

You seem to be assuming that you've written a function without errors;
since you're getting an error message, that seems unlikely. Look for
error messages from the compiler. Look at your Makefile and at the
way you're invoking the "make" command to be sure that it's letting
you see any messages from the compiler.

For help with using make, post to comp.unix.programmer. If you can
see the compiler's output, pay attention to the messages; if they
indicate a problem in your C source, and you have trouble correcting
it, post here with more details. If the problem has to do with a
system-specific feature, rather than with the core C language and
library, we might redirect you; in particular, sockets are not part of
standard C, and can be discussed in comp.unix.programmer.

You might also want to read this:
<http://www.catb.org/~esr/faqs/smart-questions.html>.

--
Keith Thompson (The_Other_Keith) <[email protected]>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Thank's for your answer.
This is the c code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winsock.h>
#include <windows.h>

void err_fatal(char *);
int readn(SOCKET, char *, int);


main()
{
/* apertura connessione lato client */
int taddr_n, tport_n;
struct sockaddr_in saddr;
int result;
char buffer[1024]; // buffer

SOCKET s;
WSADATA data; // inizializzo la variabile che contiene le primitive
di Winsock
WORD p;
int err=0;
p=MAKEWORD(2,0); // creo la variabile p che contiene la versione
della wsock32.dll
err=WSAStartup(p,&data); // inizializzo la wsock32.dll verificandone
la mancanza di errori

/* creazione socket */
s=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(s==INVALID_SOCKET) err_fatal("socket() failed!");
printf("Creazione socket riuscita\n");
printf("\nConnessione...\n");

//taddr_n=inet_addr("130.192.3.45"); /* restituisce l'indirizzo in
ordine di rete */
//tport_n=htons(25);
taddr_n=inet_addr("127.0.0.1");
tport_n=htons(1037);

saddr.sin_family=AF_INET;
saddr.sin_port=tport_n;
saddr.sin_addr.s_addr=taddr_n;

result=connect(s,(struct sockaddr*) &saddr,sizeof(struct sockaddr));
if(result==-1) err_fatal("connect() failed!");

/* Riceve un messaggio */
if((readn(s,buffer,sizeof(buffer)))==0) err_fatal("read() failed!");

/* Stampa il messaggio ricevuto */
printf("Ho ricevuto: %s\n",buffer);

system("pause");

/* Chiude i socket */
WSACleanup();
closesocket(s);
}

/* stampa errore */
void err_fatal(char *mes)
{
printf("%s, errno=%d\n",mes,WSAGetLastError());
perror("");
system("pause");
exit(1);
}

/* lettura di n byte */
int readn(SOCKET s, char *ptr, int len)
{
int nread;
nread=recv(s,ptr,len,0);
return nread;
}


it's a simply program that uses the "socket" to communicate with a
server.
Made the compilation the ONLY error(Any Warning, any other error!!)
that I have it is:

*** ["../Socket/Client/Client.o"] Error 1

The compiler that I use is the Dev-C++.
The description of the error is simply this: without other number
codes or various comments.
I know that the description is "vague": in fact doesn't help a lot me
to resolve the problem!

This is everything.
 
M

M.Caggiano

M.Caggiano said:
I've write a function without errors but i've this message after
compilation:
*** ["../Socket/Client/Client.o"] Error1
how can i resolve this problem?
Many many thanks in advance.
First of all, it's important to copy-and-paste the *exact* error
message. Whatever tool produced the message, I suspect it actually
printed "Error 1", not "Error1". This may seem like a trivial point,
but we can't guess what other errors you may have inadvertently
produced when you re-typed the message.
As it happens, the form of the error message looks familiar; it
appears to be from the GNU "make" command, and it indicates that
*some* command, intended to create the file
"../Socket/Client/Client.o", failed with a status code of 1. Most
likely that command was the compiler. Normally you should have seen
the compiler's output just before the message you quoted. The most
likely explanations are (a) you've failed to show us the relevant
output (without which we can't possibly guess what the problem is), or
(b) the make command was invoked in such a way that it discarded the
compiler's diagnostic output (which would be an odd thing to do).
You seem to be assuming that you've written a function without errors;
since you're getting an error message, that seems unlikely. Look for
error messages from the compiler. Look at your Makefile and at the
way you're invoking the "make" command to be sure that it's letting
you see any messages from the compiler.
For help with using make, post to comp.unix.programmer. If you can
see the compiler's output, pay attention to the messages; if they
indicate a problem in your C source, and you have trouble correcting
it, post here with more details. If the problem has to do with a
system-specific feature, rather than with the core C language and
library, we might redirect you; in particular, sockets are not part of
standard C, and can be discussed in comp.unix.programmer.
--
Keith Thompson (The_Other_Keith) <[email protected]>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Thank's for your answer.
This is the c code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winsock.h>
#include <windows.h>

void err_fatal(char *);
int readn(SOCKET, char *, int);

main()
{
/* apertura connessione lato client */
int taddr_n, tport_n;
struct sockaddr_in saddr;
int result;
char buffer[1024]; // buffer

SOCKET s;
WSADATA data; // inizializzo la variabile che contiene le primitive
di Winsock
WORD p;
int err=0;
p=MAKEWORD(2,0); // creo la variabile p che contiene la versione
della wsock32.dll
err=WSAStartup(p,&data); // inizializzo la wsock32.dll verificandone
la mancanza di errori

/* creazione socket */
s=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(s==INVALID_SOCKET) err_fatal("socket() failed!");
printf("Creazione socket riuscita\n");
printf("\nConnessione...\n");

//taddr_n=inet_addr("130.192.3.45"); /* restituisce l'indirizzo in
ordine di rete */
//tport_n=htons(25);
taddr_n=inet_addr("127.0.0.1");
tport_n=htons(1037);

saddr.sin_family=AF_INET;
saddr.sin_port=tport_n;
saddr.sin_addr.s_addr=taddr_n;

result=connect(s,(struct sockaddr*) &saddr,sizeof(struct sockaddr));
if(result==-1) err_fatal("connect() failed!");

/* Riceve un messaggio */
if((readn(s,buffer,sizeof(buffer)))==0) err_fatal("read() failed!");

/* Stampa il messaggio ricevuto */
printf("Ho ricevuto: %s\n",buffer);

system("pause");

/* Chiude i socket */
WSACleanup();
closesocket(s);

}

/* stampa errore */
void err_fatal(char *mes)
{
printf("%s, errno=%d\n",mes,WSAGetLastError());
perror("");
system("pause");
exit(1);

}

/* lettura di n byte */
int readn(SOCKET s, char *ptr, int len)
{
int nread;
nread=recv(s,ptr,len,0);
return nread;

}

it's a simply program that uses the "socket" to communicate with a
server.
Made the compilation the ONLY error(Any Warning, any other error!!)
that I have it is:

*** ["../Socket/Client/Client.o"] Error 1

The compiler that I use is the Dev-C++.
The description of the error is simply this: without other number
codes or various comments.
I know that the description is "vague": in fact doesn't help a lot me
to resolve the problem!

This is everything.

A last precise statement: it needs to linking the project with:
"libws2_32.a"
Otherwise the compiler doesn't recognize any necessary functions for
the use of the sockets.
 
M

M.Caggiano

---ATTENTION---
Problem resolved boys!!
Thanks to everybody.
Now however I will open a new discussion from the title "Socket: bind
error...why??"
 
M

M.Caggiano

Excellent! Please tell us what the problem was and how you
resolved it.

would be a much better forum for
discussion of networking code.

I have not exactly understood sincerely the motive for this type of
error.
The solution has been banal: have simply revolved the obstacle!

Have recopied the whole code in a new file contained in a new project
and once compiled....... any error!

I don't have idea of the why.
Do you succeed in explaining you him?
 
M

Mark McIntyre

M.Caggiano wrote:

(snip unix-specific sockets code)
This is everything.

Not quite everything - you forgot to explain how you're compiling, what
flags you passed to the compiler and linker etc.

By the way, the code is very unix-like. You may have much more luck in
comp.unix.programming. Or a Dev-C++ newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top