2 registered members (TedMar, AndrewAMD),
1,344
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
workshop 2 problems
#200875
04/05/08 23:28
04/05/08 23:28
|
Joined: Aug 2007
Posts: 56 Maine
NITRO_2008
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2007
Posts: 56
Maine
|
Hi, I am trying to learn lite-C but I had trouble compiling code pasted from the 2cnd workshop. So I did a search here and found out that I must save as a .c file. After I did that I got more errors. It said that I was missing a bracket, but I cannot find where I am missing it. Here is a screenshot, tell me if you can read it, if you cannot I'll try a different resolution of screenshot. Thanks
|
|
|
Re: workshop 2 problems
[Re: NITRO_2008]
#200877
04/05/08 23:39
04/05/08 23:39
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
The first thing I can see is that you have: PANEL pDisplay = {} but it has to be a pointer: PANEL* pDisplay = {}
Last edited by Slin; 04/05/08 23:39. Reason: too late -.- :P
|
|
|
Re: workshop 2 problems
[Re: NITRO_2008]
#200883
04/06/08 00:00
04/06/08 00:00
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
I just rewrote you code and it works without a problem:
#include <acknex.h>
#include <default.c>
var a = 1;
var b = 2;
var c = 0;
PANEL* pDisplay =
{
digits(35,10,"a = %0.f",*,1,a);
digits(35,19,"b = %0.f",*,1,b);
digits(35,28,"c = %0.f",*,1,c);
flags = VISIBLE;
}
function main()
{
video_mode = 6;
screen_color.blue = 150;
while(1)
{
c = a+b;
wait(1);
}
}
Other than that function is C-Script, use the datatype of the return value instead which doesn´t exist in your function main and thus "function" should be "void" in the case. But that has nothing to do with your problem...
|
|
|
Re: workshop 2 problems
[Re: NITRO_2008]
#200887
04/06/08 00:09
04/06/08 00:09
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
If you you have a .c file and a .wdl file with the same name (except for the file extension) the .wdl file is compiled too. This is required in the current official release as .wdl files are still needed for giving PATH and PLUGINDIR statements. The current beta version got rid of the need to have a .wdl file for this.
Last edited by Uhrwerk; 04/06/08 00:17. Reason: I am the one that posts faster as his shadow!! *evil-laughter*
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: workshop 2 problems
[Re: NITRO_2008]
#200888
04/06/08 00:12
04/06/08 00:12
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
If there is a .wdl file with the name of the .c file it will be compiled first. This was needed to set things like the plugindir. Just look at the betapage for the PRAGMA_ defines which now replace the need for a .wdl file. Other than that you can combine C-Script and Lite-C, but that is a bit different because the function main has to be in the .wdl file and you just include the .c file as any other script. That one needs a startup function which works as function main for the lite-c part because it is not possible to share functions or variables or such between them. But that allows for example to use the new postprocessing features in a c-script project.
And I was again too late :P
Last edited by Slin; 04/06/08 00:12.
|
|
|
Re: workshop 2 problems
[Re: NITRO_2008]
#200889
04/06/08 00:12
04/06/08 00:12
|
Joined: Aug 2007
Posts: 56 Maine
NITRO_2008
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2007
Posts: 56
Maine
|
OK I have reposted the original screen shot with some painted blue lines to show you that the compiler seemed to be attempting to compile two scripts at once. See how it was trying to compile the old test_1.wdl? I was not able to run the new script because the old one was interfering somehow. I tried to retrace the it again by making new files and testing it but I could not reproduce the problem. Oh well. Thanks a lot.
|
|
|
Re: workshop 2 problems
[Re: Slin]
#200892
04/06/08 00:17
04/06/08 00:17
|
Joined: Aug 2007
Posts: 56 Maine
NITRO_2008
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2007
Posts: 56
Maine
|
If there is a .wdl file with the name of the .c file it will be compiled first. This was needed to set things like the plugindir. Just look at the betapage for the PRAGMA_ defines which now replace the need for a .wdl file. Other than that you can combine C-Script and Lite-C, but that is a bit different because the function main has to be in the .wdl file and you just include the .c file as any other script. That one needs a startup function which works as function main for the lite-c part because it is not possible to share functions or variables or such between them. But that allows for example to use the new postprocessing features in a c-script project.
And I was again too late :P If you you have a .c file and a .wdl file with the same name (except for the file extension) the .wdl file is compiled too. This is required in the current official release as .wdl files are still needed for giving PATH and PLUGINDIR statements. The current beta version got rid of the need to have a .wdl file for this. Ohh OK. Now I get it. Thanks a lot.
|
|
|
|