Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Can't Compile with additional source files?

Author
Message
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Oct 2011 12:03 Edited at: 1st Oct 2011 12:04
I just moved some of my functions to a new source file (Initialise.agc). Now, I can Run (Ctrl-F5) the game, but I can't Compile (F4, Ctrl-F4 or F5) the game, because it cannot find the Init() routine in the new file.

As you can see in the screenshot, the new file is part of the project, and Running works, so what have I done wrong?



Attachments

Login to view attachments
Hubdule
21
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 1st Oct 2011 12:22
Use



at the top of your code then it'll work again

Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 1st Oct 2011 12:37
I found errors with the #include command, see the google issue board, issue #83

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
Hubdule
21
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 1st Oct 2011 12:51
The "problem" is that included files get appended at the end of the final source code. So your Globals etc. get dimed at the end. Have you tried to put your Dim and LoadImage code into a sub?



Maybe that'll work

Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 1st Oct 2011 14:02 Edited at: 1st Oct 2011 14:03
Thanks Hubdule ! You fixed my issue

I now just gosub the content of the include files just after the #include command, and now it gets declared at the start of the program.

I think the #include command, should insert source files infront of the main, not after... makes more sense.

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
Hubdule
21
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 1st Oct 2011 14:45
No problem. I think it's just easier to implement something like

-> Main file
-> Append include file
-> Append include file

then

-> Main file -> search for right position
-> merge all includes there
-> then add the rest of the main file

But it's nice to know now that it works like that.

MikeHart
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 1st Oct 2011 17:16
I was wondering why it was behaving strangly. Now that you have mentioned that includes get appended and not inserted, it makes sence. Weird but it is workable.

Login to post a reply

Server time is: 2024-04-20 05:42:58
Your offset time is: 2024-04-20 05:42:58