Anjuta and SDL

Hello, IF the problem is that you defined a global variable in your .h,
and you included your header from multiple files, i propose try this:

Make the definition of the variable extern in the header
Define the variable as static in only one .c file, where you think this
variable belongs.

Hope to help

El mi?, 03-12-2003 a las 17:09, John Silicon escribi?:> Everything in the Makefile looks good (just one odd thing: CFLAGS has

two -ggdb’s in it), so it must be some weird thing with the code or
compiler.
First, what compiler/OS are you using (and if it’s a multi-target compiler
[gcc/g++], what system are you building for)?
Second, if you know it’s not the compiler, any chance you’re willing to post
the code, so we can help pin it down? (Remember: code errors are least
obvious to the person who wrote it)

  • Silicon

----- Original Message -----
From: “Jorge L.Martin C.”
To:
Sent: Wednesday, December 03, 2003 11:24 AM
Subject: Re: [SDL] SDL C++

That’s the problem, I already have #ifndef

#ifndef DB_H
#define DB_H



#endif

On Wed, 2003-12-03 at 01:19, Richard Schreyer wrote:

I’m guessing gui.cpp:23 is actually an #include (because it’s near the
top of the file).

Be sure that you surround that included header with something like

// gui.cpp
// does something interesting

#include something useful

#ifndef GUI_H
#define GUI_H

some code here

#endif

The problem is that multiple source files are including the same
header, so whatever is in that header gets defined multiple times, each
in a different object (.o) file.

When all the object files are linked together, more than one defines
loadData(), and the linker has a fit.

Just add those #ifndef and #define with some unique value, so the
contents of that will only ever be loaded once.

Richard Schreyer

On Dec 2, 2003, at 10:11 AM, Jorge L.Martin C. wrote:

Sorry if you receive this message twice, I’m having problems with my
mail system…

Hi again guys, I’m trying to change my code from C to C++, what I do
is

change my cc compiler to g++ then clear all errors and warnings, no
problem here, but now I have a lot of strange errors like this

“gui.o(.bss+0x20):In function ‘loadData()’:”
"…/gui.cpp:23:multiple definition of ‘ScoreV’"

The strange part here is that the line 23 don’t even use the var
ScoreV,
in some cases the refered variable isn’t present on the file.

I’m trying to find the problem, I guess it’s an link problem, but I
don’t know how to solve it.

Any ideas?

Thx.

Pd. Attached is a copy of my Makefile, I think the problem is in the
way
I’m copiling, appreciate your help.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.547 / Virus Database: 340 - Release Date: 12/2/2003


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl