Skip to main content
GameDev.net gamedev.net
🔒 Locked

C Compiler errors

Started by yellowstar Aug 22, 2008 at 4:34 PM 4 replies 2.2k views
Original Post
yellowstar
yellowstar
I'm getting compiler errors when compiling the NDS homebrew SDK for Wmb Asm.(With devkitARM. I'm posting here because I got zero help with these errors on a DS homebrew forum) Errors:

> "make" 
dirscan.c
arm-eabi-gcc -MMD -MP -MF /c/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/build/dirscan.d -g -Wall -O2 -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -I/c/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/include -I/c/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK//c/devkitPro\libnds\include  -I/c/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/build -DARM9 -c /c/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/dirscan.c -o dirscan.o
In file included from c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/dirscan.c:24:
c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/..\include\wmb_asm_sdk.h:60: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PCAP_CheckAVS'
In file included from c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/..\include\wmb_asm_sdk.h:125,
                 from c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/dirscan.c:24:
c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/..\include\/../include/pcap.h:55: error: expected specifier-qualifier-list before 'bool'
c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/..\include\/../include/pcap.h:79: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'GetPacketHasAVS'
c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/..\include\/../include/pcap.h:80: error: expected ')' before 'val'
In file included from c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/dirscan.c:24:
c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/..\include\wmb_asm_sdk.h:235: error: expected specifier-qualifier-list before 'bool'
c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/..\include\wmb_asm_sdk.h:519: error: expected ':', ',', ';', '}' or '__attribute__' before 'data_init'
c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/..\include\wmb_asm_sdk.h:596: error: expected specifier-qualifier-list before 'bool'
In file included from c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/..\include\wmb_asm_sdk.h:736,
                 from c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/dirscan.c:24:
c:/YellowstarConsoleStuff/wmb_asm/SVN/trunk/wmb_asm/SDK/source/..\include\/wmb_asm_sdk_internal.h:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
make[1]: *** [dirscan.o] Error 1
"make": *** [build] Error 2

Link to dirscan.c in SVN. wmb_asm_sdk.h:

/*
Wmb Asm, the SDK, and all software in the Wmb Asm package are licensed under the MIT license:
Copyright (c) 2008 yellowstar

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the “Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#ifndef _H_WMB_ASM_SDK
#define _H_WMB_ASM_SDK

#define ASM_SDK_VERSION_MAJOR 1
#define ASM_SDK_VERSION_MINOR 0
#define ASM_SDK_VERSION_RELEASE 0
#define ASM_SDK_VERSION_BUILD 0
#define ASM_SDK_VERSION_STR "1.0b"

#define ASM_MODULE_VERSION_MAJOR 2//These defines are the Wmb Asm Module version this version of the SDK was built with.
#define ASM_MODULE_VERSION_MINOR 0
#define ASM_MODULE_VERSION_RELEASE 1
#define ASM_MODULE_VERSION_BUILD 0
#define ASM_MODULE_VERSION_STR "2.0b r2"

#ifndef __cplusplus
    enum bool {false = 0, true = 1};
#endif

#ifdef BUILDING_SDK
    
    #ifndef BUILDING_DLL
        #undef DLLIMPORT
        #define DLLIMPORT
        #undef USING_DLL
    #endif
    
    #ifdef BUILDING_DLL
        #undef DLLIMPORT
        #define DLLIMPORT __declspec (dllexport)
    #endif
    
    #ifdef BUILDING_DLL
        #ifndef USING_DLL
            #define USING_DLL
        #endif
    #endif
    
    extern bool PCAP_CheckAVS;//wmb_asm_sdk.h compiler errors here
    
#endif

wmb_asm_sdk_internal.h

//This file is included by wmb_asm_sdk.h, but only if we are building the SDK.

#ifdef BUILDING_SDK
    
    #ifndef WMB_ASM_SDK_INTERNAL
    #define WMB_ASM_SDK_INTERNAL
        
        #ifdef SDK_MAIN
            volatile struct Nds_data **sdk_nds_data = NULL;
            bool *SDK_DEBUG = NULL;
            FILE **SDK_Log = NULL;
            struct sAsmSDK_Config *SDK_CONFIG = NULL;
        #endif
        
        #ifndef SDK_MAIN
            extern volatile struct Nds_data **sdk_nds_data;
            extern bool *SDK_DEBUG;//wmb_asm_sdk_internal.h compiler errors here
            extern FILE **SDK_Log;
            extern struct sAsmSDK_Config *SDK_CONFIG;
        #endif
        
    #endif
    
#endif


pcap.h

/*
Wmb Asm, the SDK, and all software in the Wmb Asm package are licensed under the MIT license:
Copyright (c) 2008 yellowstar

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the “Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

//Custom pcap implemention with the same interface as libpcap, to easily switch between using my implemention, and libpcap, and so captures with truncated packets can be used. These packets are skipped, it doesn't stop reading the capture all together. Before this was implemented, it was impossible to assemble captures with truncated packets, with libpcap.

#ifndef lib_pcap_h

    #ifndef _H_CUSTOM_PCAP
    #define _H_CUSTOM_PCAP

    #define PCAP_VERSION_MAJOR 2
    #define PCAP_VERSION_MINOR 4
    
    #define PCAP_ERRBUF_SIZE 256
	
    typedef unsigned char u_char;
    typedef unsigned int u_int;
    
    typedef struct spcap_file_header {
	   unsigned int magic;
	   unsigned short majorVersion;
	   unsigned short minorVersion;
	   unsigned int timeZoneOffset;
	   unsigned int timeStampAccuracy;
	   unsigned int snapshotLength;
	   unsigned int linkLayerType;
    } __attribute__ ((__packed__)) pcap_file_header;

    typedef struct spcap_pkthdr {
	   long tv_sec;
        long tv_usec;	/* time stamp */
	   unsigned int caplen;	/* length of portion present */
	   unsigned int len;	/* length this packet (off wire) */
    } __attribute__ ((__packed__)) pcap_pkthdr;
    
    struct pcap_t
	{
		FILE *file;
		bool swap;//Error here
		pcap_pkthdr header;
		unsigned char *pktdata;
		char *error_buffer;
	} __attribute__ ((__packed__));
	
	#ifdef __cplusplus
    extern "C" {
    #endif
	
        struct pcap_t  *pcap_open_offline(const char *filename, char *errbuf);
        int     pcap_next_ex(struct pcap_t *file, pcap_pkthdr **hdr, const u_char **pktdata);
        void    pcap_close(struct pcap_t *file);
        char    *pcap_geterr(struct pcap_t *file);
        
        #ifdef ASM_SDK_CLIENT
            int GetPacketNumber();//Yeah, this may seem strange having double prototypes here, but it's nesscary due to compiler errors that result when removing the double and the preprocesser directives.
        #endif
        
        #ifdef BUILDING_SDK
            int GetPacketNumber();
        #endif
        
        int GetSnapshotLength();
        bool GetPacketHasAVS();//Error here
        void SetPacketHasAVS(bool val);//Error here
    
    #ifdef __cplusplus
    }
    #endif

    #endif
    
#endif


My Website:link(Not hosted by Gamedev)
ToohrVyk
ToohrVyk
That "bool" enumeration definition is weird. It should be typedef enum { ... } bool instead, otherwise you'd need the namespace qualifier "enum bool" everywhere.
yellowstar
yellowstar
Thanks. After changing that, and pre-appending numerous structs in front of references to structs/code using structs, the SDK compiled successfully for DS. Kind of. I got one warning reporting that fat.h could not be found. Shouldn't impact anything, as the structs/prototypes in the fat.h header aren't really used in the SDK. That should be fixed anyway, though. I'll add the usual (SOLVED) note in the title of this thread once I get the rest of Wmb Asm compiled for DS.
My Website:link(Not hosted by Gamedev)
rip-off
rip-off
Quote:
Original post by yellowstar
I'll add the usual (SOLVED) note in the title of this thread once I get the rest of Wmb Asm compiled for DS.


Don't. There is no need: a "solved" post will eventually fall off the recent thread list anyway. IMO, "solved" can do more harm than good. Consider a beginner, who gets a workable but imperfect solution to their question. Is the question solved? I think not.
yellowstar
yellowstar
@rip-off:
Okay... I used to do that here because on much smaller forums, that's what people did when the problem is solved. I program in Cpp mainly. I hardly ever use C, mainly because of those obscure compiler errors, so I have a hard time fixing some C errors, like these errors in this thread.(Iirc, errors with structs were the main errors I had the most trouble with. But with other errors, I don't really have as much trouble with those.)
Quote:

Original post by rip-off:
a workable but imperfect solution to their question.

Are you referring to:
Quote:

pre-appending numerous structs in front of references to structs/code using structs

Or the enum bool issue?(I guess it's most likely the former...)

So, when defining structs in C, how am I supposed to define structs, with typedefs? And can work with linked lists? I got a lot of compiler errors when attempting to use typedef and linked lists with structs.(Errors on every attempt to fix those errors) For the "normal" usage, I tried changing one struct from struct mystruct {...} __attribute__ ((__packed__)); To typedef struct {...} __attribute__ ((__packed__)) mystruct; I also tried placing mystruct back where it was, after the struct, and keeping an altered typename after the struct, and adding the old typename at the end, but I got incomplete type compiler errors.
My Website:link(Not hosted by Gamedev)
rip-off
rip-off
I am not referring to anything in this thread in particular - I just think that the practise of marking threads as "solved" itself is flawed, and can be detrimental to the community as a whole.

The idea is discussed here.

The situation I gave was a hypothetical one - indicating one reason I dislike the idea of marking threads as "solved".

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.