Re: Building with cmake (was Re: GTKPOD 1.0.0 scripts on FreeBSD current)

Hans Petter Selasky <[email protected]> Thu, 19 Jul 2012 15:27:39 +0200
Newsgroups gmane.comp.ipod.gtkpod
Message-ID <[email protected]>
On Thursday 19 July 2012 15:23:34 Daniele Forsi wrote:
> 2012/7/19 Hans Petter Selasky:
> > Declaring variables inside a for loop is a C++ feature, not a C feature
> > ??
> 
> it's C++ and C99 section "6.8.5 Iteration statements"
> 
> > At least the compiler over here: cc (GCC) 4.2.1 20070831 patched
> > [FreeBSD]
> > 
> > Complained.
> 
> only on that line?
> I'm asking because also declaring the variable in the middle of the
> code is a C++ and C99 feature and similar code is used in several
> places:
> 
> $ grep "for (" . -rn --include=*.c | grep int
> ./libgtkpod/gtkpod_app_iface.c:640:            for (gint i = 0; i <
> g_list_length(gp_iface->track_commands); ++i) {
> ./plugins/sorttab_display/sorttab_widget.c:336:    for (gint i = 0; i
> < ST_CAT_NUM; ++i) {
> ./plugins/sorttab_display/display_sorttabs.c:69:    for (gint i = 0; i
> < sort_tab_total; ++i) {
> ./plugins/clarity/clarity_canvas.c:598:    for (gint i = 0; i <
> g_list_length(priv->covers); ++i) {
> ./plugins/playlist_display/display_playlists.c:1073:    for (gint i =
> 0; i < g_list_length(playlists); ++i) {

This is when building with cmake:

make
Merging translations into gtkpod.desktop.
[  0%] Built target desktopfile
Scanning dependencies of target gtkpod
[  2%] Building C object CMakeFiles/gtkpod.dir/libgtkpod/gtkpod_app_iface.c.o
libgtkpod/gtkpod_app_iface.c: In function 'gtkpod_execute_track_command':
libgtkpod/gtkpod_app_iface.c:640: error: 'for' loop initial declaration used 
outside C99 mode
*** Error code 1

--HPS

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/