Don't know why this compilation generated, I'm sure no 2 mains exist:
make votei
gcc vote.c datamanager.c -o votei vote.c -L. -lhungarian
vote.c: In function `main':
vote.c:254: warning: passing arg 2 of `hungarian_init' from incompatible
pointer type
vote.c: In function `main':
vote.c:254: warning: passing arg 2 of `hungarian_init' from incompatible
pointer type
/tmp/ccsVGl95.o(.text+0x0): In function `main':
: multiple definition of `main'
/tmp/ccSVKJyx.o(.text+0x0): first defined here
collect2: ld returned 1 exit status
make: *** [votei] Error 1
Makefile:
CC = gcc
AR = ar
CFLAGS = -O3 -Wall -I.
LDFLAGS = -L. -lhungarian
all: libhungarian.a hungarian_test
votei: vote.c datamanager.c $(HUNGARIANLIB)
$(CC) $(CFLAGS) vote.c datamanager.c assignmentoptimal.c -o $@ $<
$(LDFLAGS)
votei: vote.c datamanager.c $(HUNGARIANLIB)
$(CC) vote.c datamanager.c -o $@ $< $(LDFLAGS)
why comp.lang.c faq hasn't covered compilation topic? Where should I go for
more information? 11 9234
a wrote:
Don't know why this compilation generated, I'm sure no 2 mains exist:
You may be sure of this fact, but gcc seems to disagree. It would be
much easier to figure out whether you or gcc is right, if you had
actually bothered to give us copies of your code.
a wrote:
Don't know why this compilation generated, I'm sure no 2 mains exist:
<snip>
/tmp/ccsVGl95.o(.text+0x0): In function `main':
: multiple definition of `main'
/tmp/ccSVKJyx.o(.text+0x0): first defined here
collect2: ld returned 1 exit status
make: *** [votei] Error 1
<snip>
The above message clearly shows that two different object files are
exporting main() and therefore the linker is unable to decide which one
to use.
I am guessing that there is some mistake somewhere in your makefile or
conditional compilation directives that is allowing this to happen.
Without more information and relevant code we really cannot say anything
further.
why comp.lang.c faq hasn't covered compilation topic? Where should I
go for more information?
The comp.lang.c FAQ does not cover "compilation" because the details are
inherently implementation specific and this group tries to restrict
itself to Standard C. There are simply too many compilers with too many
idiosyncrasies to deal with in a FAQ.
You should ask for help in a group devoted to your platform or compiler.
GCC has several groups among which is <news:gnu.gcc.help>.
a wrote:
Don't know why this compilation generated, I'm sure no 2 mains exist:
make votei
gcc vote.c datamanager.c -o votei vote.c -L. -lhungarian
You have vote.c TWICE in the command line. Hence you define
main twice...
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique http://www.cs.virginia.edu/~lcc-win32
In article <5e**********************************@b40g2000prf. googlegroups.com>,
<ja*********@verizon.netwrote:
>a wrote:
>You may be sure of this fact, but gcc seems to disagree. It would be much easier to figure out whether you or gcc is right, if you had actually bothered to give us copies of your code.
Actually, he gave us all the information we need, as Jacob spotted.
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Richard Tobin wrote:
In article <5e**********************************@b40g2000prf. googlegroups.com>,
<ja*********@verizon.netwrote:
a wrote:
You may be sure of this fact, but gcc seems to disagree. It would be
much easier to figure out whether you or gcc is right, if you had
actually bothered to give us copies of your code.
Actually, he gave us all the information we need, as Jacob spotted.
You're right - I should have read more carefully.
Still, he should have provided source code, just in case the problem
was in the code itself, and not on the command line.
Yes you are right. It is nothing dealt with the codes...
jacob navia wrote:
a wrote:
>Don't know why this compilation generated, I'm sure no 2 mains exist:
make votei gcc vote.c datamanager.c -o votei vote.c -L. -lhungarian
You have vote.c TWICE in the command line. Hence you define
main twice...
Well spotted.
a wrote:
>
Yes you are right. It is nothing dealt with the codes...
Meaningless. See below.
--
If you want to post a followup via groups.google.com, ensure
you quote enough for the article to make sense. Google is only
an interface to Usenet; it's not Usenet itself. Don't assume
your readers can, or ever will, see any previous articles.
More details at: <http://cfaj.freeshell.org/google/>
--
Posted via a free Usenet account from http://www.teranews.com
On Nov 29, 12:18 am, Mark McIntyre <markmcint...@spamcop.netwrote:
jacob navia wrote:
a wrote:
Don't know why this compilation generated, I'm sure no 2 mains exist:
make votei
gcc vote.c datamanager.c -o votei vote.c -L. -lhungarian
You have vote.c TWICE in the command line. Hence you define
main twice...
Well spotted.
I suppose it's out of the question for gcc to detect duplicate source
filenames? (Comparing 2 filespecs is that trivial but for something as
sophisticated as gcc?..)
Bart
Bart wrote:
>
On Nov 29, 12:18 am, Mark McIntyre <markmcint...@spamcop.netwrote:
jacob navia wrote:
a wrote:
>Don't know why this compilation generated, I'm sure no 2 mains exist:
>make votei
>gcc vote.c datamanager.c -o votei vote.c -L. -lhungarian
You have vote.c TWICE in the command line. Hence you define
main twice...
Well spotted.
I suppose it's out of the question for gcc to detect duplicate source
filenames? (Comparing 2 filespecs is that trivial but for something as
sophisticated as gcc?..)
While this is OT here, what happens with something like:
gcc file.c -DSOMETHING file.c
Perhaps file.c will compile differently in the second case, due to
SOMETHING now being defined. (Not that I'm advocating this to be
good practice in a real-world environment, mind you.)
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
In article <47***************@spamcop.net>,
Kenneth Brody <ke******@spamcop.netwrote:
>Bart wrote:
>> On Nov 29, 12:18 am, Mark McIntyre <markmcint...@spamcop.netwrote:
jacob navia wrote:
a wrote: Don't know why this compilation generated, I'm sure no 2 mains exist:
make votei gcc vote.c datamanager.c -o votei vote.c -L. -lhungarian
You have vote.c TWICE in the command line. Hence you define
main twice...
Well spotted.
I suppose it's out of the question for gcc to detect duplicate source filenames? (Comparing 2 filespecs is that trivial but for something as sophisticated as gcc?..)
While this is OT here, what happens with something like:
gcc file.c -DSOMETHING file.c
Perhaps file.c will compile differently in the second case, due to SOMETHING now being defined. (Not that I'm advocating this to be good practice in a real-world environment, mind you.)
Right - that's the counter-example. It is certainly possible to create
a fully conforming situation where something would be broken if the
compiler refused to do what it is told. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Georg Teichtmeister |
last post by:
Hello!
We are developing a math - library for realtime applications and want to
use some given mathlibraries as base(ipp, MTL, .. ). Our library is a
wrapper for those and you should be able to...
|
by: Daniel Moree |
last post by:
I'm using MS VC++ 6.0
I'm working on a big project. I've currently have several files for this
project.
Here's the problem.
I have one header file phead.h
I have two code files main.cpp and...
|
by: Charles L |
last post by:
Can someone explain to me what the following means?
"C permits multiple definitions of a variable in any given namespace,
provided the definitions are the same and it generates only a single...
|
by: Panda2 |
last post by:
I'm getting multple definition errors for the struct in the following,
and I don't know how to get around it. I've tried using extern (which
I don't really understand) but it didn't help (maybe...
|
by: Tony Johansson |
last post by:
Hello Experts!
I just play around just to try to understand this about multiple
inheritance.
You have all the class definition below and at the bottom you have the main
program.
So here I...
|
by: PCHOME |
last post by:
Hi!
Would someone please help me thess C error(in gcc on Linux)?
The compiler continues to give me:
readLP.o: In function `Input_Problem':
readLP.o(.text+0x0): multiple definition of...
|
by: Student |
last post by:
Hi all,
While compiling a program I had this message :
tools.o(.data+0x0): multiple definition of `VAR_1'
main.o(.data+0x0): first defined here
tools.o(.data+0x4): multiple definition of...
|
by: chandu |
last post by:
Hello,
I had one doubt,please clarify it.
Main is the entry point for the application.
if i had multiple overloaded main methods in my application.
how the compiler recognizes the original...
|
by: Antonio Rivas |
last post by:
Hello all.
I've got a problem of multiple definition in a program that at first
glance looks correct (I won't type the whole code, just the relevant one
and as examples since seems is a linkage...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |