Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Syntax error in util.c

 
Post new topic   Reply to topic Printable version
 View previous topic  AS3, Subgame, and the End-User Post :: Post How much time between fakepositions?  View next topic  
Author Message
Agile
Guest


Offline

PostPosted: Wed Feb 27, 2008 11:34 pm    Post subject: Syntax error in util.c Reply to topic Reply with quote

Haven't touched this file at all, simply needed to include it to get autoturret to work, and I get the following errors when compiling autoturret/similar modules:
C:/asss-1.4.4/src/main/util.c:476: error: syntax error before '*' token
C:/asss-1.4.4/src/main/util.c:481: error: syntax error before '*' token

You can all look at the file yourselves, it's undoubtedly the same but here is the code:
Code: Show/Hide

Link * LLGetHead(LinkedList *lst)
{
   return lst->start;
}

int LLIsEmpty(LinkedList *lst)
{
   return lst->start == NULL;
}


Not really sure what to make of that at all. Help?
-JP
Back to top
tcsoccerman
Server Help Squatter


Age:33
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Thu Feb 28, 2008 4:23 pm    Post subject: Reply to topic Reply with quote

i think it's the double "=". remove one of them in 1rst->start == NULL line
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Feb 28, 2008 4:32 pm    Post subject: Reply to topic Reply with quote

tcsoccerman wrote:
i think it's the double "=". remove one of them in 1rst->start == NULL line

That would make it return the value of the assigned value. Which would ALWAYS be 0.
So... no.

It says syntax error before... make sure the preceding code doesn't lack a ';' or something.

Also, make sure the type 'Link' is defined for that part of the code
_________________
(Insert a bunch of dead links here)
Back to top
View users profile Send private message Add User to Ignore List
Doc Flabby
Server Help Squatter


Joined: Feb 26 2006
Posts: 636
Offline

PostPosted: Thu Feb 28, 2008 4:35 pm    Post subject: Reply to topic Reply with quote

maybe you made this mistake of including the "utils.c" file instead of "utils.h"
_________________
Rediscover online gaming. Get Subspace | STF The future...prehaps
Back to top
View users profile Send private message Add User to Ignore List
Agile
Guest


Offline

PostPosted: Thu Feb 28, 2008 7:09 pm    Post subject: Reply to topic Reply with quote

Well, util.h is included at the bottom of util.c, so if you include c you also get h.
The reverse is not true as far as I know, and if I compile without util.c I get linker errors on amalloc and all the LL functions being undefined.
Back to top
Agile
Guest


Offline

PostPosted: Thu Feb 28, 2008 7:24 pm    Post subject: Reply to topic Reply with quote

Also, there are plenty of places Link is in the source and it only gives an error on that one line containing Link. It never complains anywhere else about Link being undefined...I'll check it out but I don't think that's the cause.
It also gives the SAME ERROR 4 lines down, in the int LLIsEmpty line.

There is quite clearly no syntax error there, so I'm stumped.

Also I noted that util.c is not even normally included in autoturret.c... how does that even compile for grelminar without util.h or util.c?

-JP
Back to top
Doc Flabby
Server Help Squatter


Joined: Feb 26 2006
Posts: 636
Offline

PostPosted: Thu Feb 28, 2008 9:08 pm    Post subject: Reply to topic Reply with quote

Agile wrote:
Well, util.h is included at the bottom of util.c, so if you include c you also get h.
The reverse is not true as far as I know, .

Trust me on this. You are wrong.

The reverse is true. If you only include util.h the compiler will find util.c and link it in.

This is a case of counter-intuitiveness, what may seem correct and logical, is in fact wrong.

You shouldn't be including any files that end in ".c" in your source code. you should only need to include asss.h as that includes a reference to utils.h anyway.

Bascially you only need to include the interfaces (the files ending in .h) not the implementation. The Compiler will work out that for you..
Back to top
View users profile Send private message Add User to Ignore List
Agile
Guest


Offline

PostPosted: Thu Feb 28, 2008 10:36 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing  make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
dllwrap.exe --output-def outputdir/libProject2.def --driver-name c++ --implib outputdir/libProject2.a outputdir/RTZ.o  -L"C:/Dev-Cpp/lib" -L"C:/posix/Pre-built.2/lib"   -o outputdir/Project2.dll

outputdir/RTZ.o(.text+0x19):RTZ.c: undefined reference to `amalloc'
outputdir/RTZ.o(.text+0xc4):RTZ.c: undefined reference to `LLAdd'
outputdir/RTZ.o(.text+0xdb):RTZ.c: undefined reference to `LLCount'
outputdir/RTZ.o(.text+0x139):RTZ.c: undefined reference to `LLSize'
outputdir/RTZ.o(.text+0x172):RTZ.c: undefined reference to `LLCount'
outputdir/RTZ.o(.text+0x1d0):RTZ.c: undefined reference to `LLSize'
outputdir/RTZ.o(.text+0x2e1):RTZ.c: undefined reference to `LLInit'
outputdir/RTZ.o(.text+0x397):RTZ.c: undefined reference to `LLEmpty'
collect2: ld returned 1 exit status

dllwrap.exe: no export definition file provided.
Creating one, but that may not be what you want
dllwrap.exe: c++ exited with status 1

make.exe: *** [outputdir/Project2.dll] Error 1

Execution terminated
Back to top
Agile
Guest


Offline

PostPosted: Thu Feb 28, 2008 10:37 pm    Post subject: Reply to topic Reply with quote

^compiled with asss.h and without util.c
Back to top
Doc Flabby
Server Help Squatter


Joined: Feb 26 2006
Posts: 636
Offline

PostPosted: Fri Feb 29, 2008 7:51 am    Post subject: Reply to topic Reply with quote

Agile wrote:
Code: Show/Hide
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing  make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
dllwrap.exe --output-def outputdir/libProject2.def --driver-name c++ --implib outputdir/libProject2.a outputdir/RTZ.o  -L"C:/Dev-Cpp/lib" -L"C:/posix/Pre-built.2/lib"   -o outputdir/Project2.dll

outputdir/RTZ.o(.text+0x19):RTZ.c: undefined reference to `amalloc'
outputdir/RTZ.o(.text+0xc4):RTZ.c: undefined reference to `LLAdd'
outputdir/RTZ.o(.text+0xdb):RTZ.c: undefined reference to `LLCount'
outputdir/RTZ.o(.text+0x139):RTZ.c: undefined reference to `LLSize'
outputdir/RTZ.o(.text+0x172):RTZ.c: undefined reference to `LLCount'
outputdir/RTZ.o(.text+0x1d0):RTZ.c: undefined reference to `LLSize'
outputdir/RTZ.o(.text+0x2e1):RTZ.c: undefined reference to `LLInit'
outputdir/RTZ.o(.text+0x397):RTZ.c: undefined reference to `LLEmpty'
collect2: ld returned 1 exit status

dllwrap.exe: no export definition file provided.
Creating one, but that may not be what you want
dllwrap.exe: c++ exited with status 1

make.exe: *** [outputdir/Project2.dll] Error 1

Execution terminated


In this case the file has compiled correctly. The problem is the linking is messed up.
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Fri Feb 29, 2008 8:02 am    Post subject: Reply to topic Reply with quote

add util.o to your linker settings.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Agile
Guest


Offline

PostPosted: Fri Feb 29, 2008 4:20 pm    Post subject: Reply to topic Reply with quote

OK, that did it $
I'm wondering now why the linking failed in the first place? What could have caused that?
Back to top
Agile
Guest


Offline

PostPosted: Fri Feb 29, 2008 5:14 pm    Post subject: Reply to topic Reply with quote

Lol, nobody told me about this thread:
http://forums.minegoboom.com/viewtopic.php?t=7389

From there I found this link:
http://wiki.minegoboom.com/index.php/Installing_New_Modules#With_Dev_C.2B.2B

This not only is a great tutorial that solved my every problem, it also made me realize I never had to download posix pthread stuff because it was already there in windeps folder.
As a result of doing this correctly my dll file is 1/5th the size it was doing things my way.

I should be pretty much set from now on, thanks everyone and look forward to RTZ zone coming soon.

PS Special Thx 2 smong,
-Agile
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 48 page(s) served in previous 5 minutes.

phpBB Created this page in 0.523803 seconds : 37 queries executed (89.3%): GZIP compression disabled