2 registered members (AndrewAMD, TipmyPip),
12,420
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Compiler freaking out? Multiple source file help!
#315380
03/15/10 02:58
03/15/10 02:58
|
Joined: Jan 2009
Posts: 19 CT, US
v3c7r0n
OP
warned - Warez
|
OP
warned - Warez
Joined: Jan 2009
Posts: 19
CT, US
|
Hi all,
I have A7 commercial, and I have built my first little test program. It's a cute little sucker, runs and compiles like a champ.
Now, starting a clean project, trying to re-write and clean up my old code, SED is giving me some just freaking weird crap.
Here's my main script:
#include <acknex.h> #include <default.c>
function main() {
PANEL* MainMenu = { MainMenu.pos_x = 0; MainMenu.pos_y = 0; MainMenu.layer = 1; MainMenu.bmap = "blue8x8.tga"; MainMenu.flags = OVERLAY | SHOW; } //////////////////////////////////////////////////////////////////// /* Initialization */ //////////////////////////////////////////////////////////////////// // PlayerData Player1;
MainMenu.pos_x = 400; MainMenu.pos_y = 300;
mouse_mode = 1; video_mode = 7; level_load("./resources/maps/FPSTest1.wmb"); //////////////////////////////////////////////////////////////////// // Main Loop //////////////////////////////////////////////////////////////////// while(1) { if(key_esc) break; wait(1); } }
It tells me all of the MainMenu variables are "Keyword Unknown"?
I also had this code broken out into files, one for menus, one called stdafx.h (The Visual Studio habits die hard...) and I was getting some funky errors about the whole business.
The way it used to look was
stdafx.h included acknex.h and default.c and Menusystem.h (my header), which originally tried to declare the following:
typedef struct MenuSystem { PANEL* MainMenu; }MenuSystem;
However, when I did that, it would run, just not work, and I'd get error E1513 when I tried to use the struct.
Does SED have something like Clean & Rebuild That forcibly recompiles all files from scratch or does it just not like multiple files?
|
|
|
Re: Compiler freaking out? Multiple source file help!
[Re: v3c7r0n]
#315399
03/15/10 08:37
03/15/10 08:37
|
Joined: May 2009
Posts: 445 Peine, Germany
Razoron
Senior Member
|
Senior Member
Joined: May 2009
Posts: 445
Peine, Germany
|
EDIT: Oups, sorry Warez user, no support.
Last edited by Razoron; 03/15/10 08:38.
|
|
|
Re: Compiler freaking out? Multiple source file help!
[Re: v3c7r0n]
#315418
03/15/10 12:12
03/15/10 12:12
|
Joined: Jan 2009
Posts: 19 CT, US
v3c7r0n
OP
warned - Warez
|
OP
warned - Warez
Joined: Jan 2009
Posts: 19
CT, US
|
More interestingly, if I simplify the struct to just declare the panel
struct TestMenu { PANEL* Menu2; };
It compiles, but once I include the file in my main.c, it comes back as unidentified. If I typedef it, it's seen, and compiles, but I get a crash as soon as I try to use it
declaration: typedef struct TestMenu { PANEL* Menu2; };
Usage in main(): TestMenu Test; Test.Menu2.pos_x = 750; // <- crash
I'm also noticing Lite-C here doesn't seem to have new & delete or malloc? I am guessing the PANEL* points to some random memory address (or NULL if lite-c defaults them to NULL), so I am guessing I will have to define another PANEL* somewhere, initialize it, and set Test.Menu2 to the panel I create?
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|