Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#27 duplicate global variables

gpsdrive-svn
open
nobody
source code (4)
7
2009-04-23
2009-04-23
Hamish B
No

Hi,

as posted to the mailing list (http://article.gmane.org/gmane.comp.linux.gps/5046/) there are a number of global variables which are defined in multiple source files and collide when the program is linked.

1. edit CFLAGS to add -fno-common:

(edit build/CMakeCache.txt,
CMAKE_BUILD_TYPE:STRING=None
...
//Flags for C compiler.
CMAKE_C_FLAGS:STRING=-g -Wall -Werror-implicit-function-declaration -Wextra -Wunused -fno-common
)

2. recompile:
(I haven't attempted to fix these as I don't know the code that well)

CMakeFiles/gpsdrive.dir/import_map.o: In function `close_import_window_cb':
/usr/src/gpsdrive/svn/trunk/src/import_map.c:190: multiple definition of `wptext2'
CMakeFiles/gpsdrive.dir/gpsdrive.o:/usr/src/gpsdrive/svn/trunk/src/gpsdrive.c:1960: first
defined here
CMakeFiles/gpsdrive.dir/main_gui.o: In function `dash_menu_cb':
/usr/src/gpsdrive/svn/trunk/src/main_gui.c:188: multiple definition of `kontext_map'
CMakeFiles/gpsdrive.dir/gpsdrive.o:/usr/src/gpsdrive/svn/trunk/src/gpsdrive.c:1773: first
defined here
CMakeFiles/gpsdrive.dir/routes.o: In function `saytargettext':
/usr/src/gpsdrive/svn/trunk/src/routes.c:118: multiple definition of `routelist'
CMakeFiles/gpsdrive.dir/map_handler.o:/usr/src/gpsdrive/svn/trunk/src/map_handler.c:116:
first defined here
CMakeFiles/gpsdrive.dir/settings.o: In function `reinitgps_cb':
/usr/src/gpsdrive/svn/trunk/src/settings.c:118: multiple definition of `menuitem_sendmsg'
CMakeFiles/gpsdrive.dir/main_gui.o:/usr/src/gpsdrive/svn/trunk/src/main_gui.c:183: first
defined here
CMakeFiles/gpsdrive.dir/waypoint.o: In function `check_and_reload_way_txt':
/usr/src/gpsdrive/svn/trunk/src/waypoint.c:116: multiple definition of `wayp'
CMakeFiles/gpsdrive.dir/gpsdrive.o:/usr/src/gpsdrive/svn/trunk/src/gpsdrive.c:1787: first
defined here
CMakeFiles/gpsdrive.dir/waypoint.o: In function `check_and_reload_way_txt':
/usr/src/gpsdrive/svn/trunk/src/waypoint.c:117: multiple definition of `maxwp'
CMakeFiles/gpsdrive.dir/gpsdrive.o:/usr/src/gpsdrive/svn/trunk/src/gpsdrive.c:1957: first
defined here
CMakeFiles/gpsdrive.dir/waypoint.o: In function `check_and_reload_way_txt':
/usr/src/gpsdrive/svn/trunk/src/waypoint.c:117: multiple definition of `add_wp_name_text'
CMakeFiles/gpsdrive.dir/gpsdrive.o:/usr/src/gpsdrive/svn/trunk/src/gpsdrive.c:1960: first
defined here
CMakeFiles/gpsdrive.dir/waypoint.o: In function `check_and_reload_way_txt':
/usr/src/gpsdrive/svn/trunk/src/waypoint.c:116: multiple definition of `addwaypointwindow'
CMakeFiles/gpsdrive.dir/gpsdrive.o:/usr/src/gpsdrive/svn/trunk/src/gpsdrive.c:1969: first
defined here
CMakeFiles/gpsdrive.dir/waypoint.o: In function `check_and_reload_way_txt':
/usr/src/gpsdrive/svn/trunk/src/waypoint.c:117: multiple definition of `gotowindow'
CMakeFiles/gpsdrive.dir/gpsdrive.o:/usr/src/gpsdrive/svn/trunk/src/gpsdrive.c:400: first
defined here
CMakeFiles/gpsdrive.dir/waypoint.o: In function `check_and_reload_way_txt':
/usr/src/gpsdrive/svn/trunk/src/waypoint.c:117: multiple definition of `wptext2'
CMakeFiles/gpsdrive.dir/gpsdrive.o:/usr/src/gpsdrive/svn/trunk/src/gpsdrive.c:1960: first
defined here
collect2: ld returned 1 exit status
make[2]: *** [src/gpsdrive] Error 1
make[1]: *** [src/CMakeFiles/gpsdrive.dir/all] Error 2
make: *** [all] Error 2

also -Wunused found a huge amount of unused variables and parameter
which need to be removed by someone on a rainy day.

very useful to add those CFLAGS!

Hamish

Discussion

  • Hamish B
    Hamish B
    2009-04-23

    • labels: --> source code
    • priority: 6 --> 7