ackexe.cpp : Tutorial Application, Lesson 1 compiling problem

Posted By: Aku_Aku

ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 07/28/16 13:57

Hi All!

I am trying to build this source: Tutorial app, lesson 1
I am using Eclipse Juno combined with GCC for Windows.

I have got the following messages in the console:
Quote:
15:47:08 **** Build of configuration Debug for project FirstProjectA8 ****
make all
Building file: ../HelloA8.cpp
Invoking: Cygwin C++ Compiler
g++ -I"D:\Program Files (x86)\GStudio8\sdk_engine" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"HelloA8.d" -MT"HelloA8.d" -o "HelloA8.o" "../HelloA8.cpp"
../HelloA8.cpp:13:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "acknex.lib")
^
In file included from D:\Program Files (x86)\GStudio8\sdk_engine/adll.h:64:0,
from ../HelloA8.cpp:24:
D:\Program Files (x86)\GStudio8\sdk_engine/afuncs.h:18:22: error: conflicting declaration of C function 'var random(var)'
EXT_var F(random)(var);
^
In file included from /usr/include/ctype.h:4:0,
from /usr/include/w32api/winnt.h:16,
from /usr/include/w32api/minwindef.h:163,
from /usr/include/w32api/windef.h:8,
from /usr/include/w32api/windows.h:69,
from ../HelloA8.cpp:17:
/usr/include/stdlib.h:234:6: note: previous declaration 'long int random()'
long _EXFUN(random,(_VOID));
^
../HelloA8.cpp: In function 'int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)':
../HelloA8.cpp:43:25: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
engine_open("arena.wmb");
^
make: *** [subdir.mk:20: HelloA8.o] Error 1

15:47:09 Build Finished (took 1s.45ms)


Could anybody explain why this error occured above?
Quote:
conflicting declaration of C function 'var random(var)'

How can i get rid of that?
Thanks in advance.
Posted By: Ch40zzC0d3r

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 07/28/16 14:10

You should really use Visual Studio since acknex can only run on windows anyways.
MSVC, clang and intels compiler are by far better then GCC.

Anyways, it simply tells you that random is already a defined function in windows.h
Posted By: Aku_Aku

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 07/28/16 14:19

Quote:
Anyways, it simply tells you that random is already a defined function in windows.h

I figured out the same. Can you tell me how can i get rid of that? My C/C++ knowledge is really dusty, it would be real help for me.

Quote:
You should really use Visual Studio since acknex can only run on windows anyways.

Yes, i know that. No problem.
Posted By: Ch40zzC0d3r

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 07/28/16 15:39

You can use a define for that.
Im not sure if its possible on a different way, never needed such a feature.

Code:
#define test	test2

int test(int i)
{
    return i * 2;
}

#undef test

int test(int i)
{
    return i * 4;
}

int main()
{
    printf("test: %i\n", test(1));

    return 0;
}

Posted By: Aku_Aku

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 07/28/16 16:46

Thanks, but i suspect, i should do something with the includes.
Posted By: Ch40zzC0d3r

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 07/28/16 17:23

#include <windows.h> after adll.h should work too
Posted By: Aku_Aku

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 07/31/16 08:38

You know the problem does not occur after the windows.h include but is in windows.h
So, putting adll.h after the windows.h doesn't solve the problem.

Anyway, thank for the advice.
Posted By: Aku_Aku

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 08/11/16 19:54

Unfortunately, the problem still persists.
Posted By: Ch40zzC0d3r

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 08/11/16 20:43

I always use
Code:
#include <windows.h>
#include <stdlib.h>
#include <d3d9.h>
#include <D3dx9core.h>
#include <D3dx9math.h>
#include <DxErr.h>

#define DLL_USE
#include "adll.h"



The define should help you here
Posted By: Aku_Aku

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 08/12/16 20:36

I tried your proposal.

I had to comment out include DxErr.h, Eclipse + GCC can't resolve.

After a build i got the following error:
Code:
In file included from D:/GStudio8/sdk_engine/adll.h:64:0,
                 from ../HelloA8.cpp:35:
D:/GStudio8/sdk_engine/afuncs.h:18:22: error: 'var (* random)(var)' redeclared as different kind of symbol
 EXT_var F(random)(var);
                      ^
In file included from /usr/include/ctype.h:4:0,
                 from /usr/include/w32api/winnt.h:16,
                 from /usr/include/w32api/minwindef.h:163,
                 from /usr/include/w32api/windef.h:8,
                 from /usr/include/w32api/windows.h:69,
                 from ../HelloA8.cpp:27:
/usr/include/stdlib.h:234:6: note: previous declaration 'long int random()'
 long _EXFUN(random,(_VOID));
      ^



The interesting thing if i comment out the #define DLL_USE, i different message:
Code:
In file included from D:/GStudio8/sdk_engine/adll.h:64:0,
                 from ../HelloA8.cpp:35:
D:/GStudio8/sdk_engine/afuncs.h:18:22: error: conflicting declaration of C function 'var random(var)'
 EXT_var F(random)(var);
                      ^
In file included from /usr/include/ctype.h:4:0,
                 from /usr/include/w32api/winnt.h:16,
                 from /usr/include/w32api/minwindef.h:163,
                 from /usr/include/w32api/windef.h:8,
                 from /usr/include/w32api/windows.h:69,
                 from ../HelloA8.cpp:27:
/usr/include/stdlib.h:234:6: note: previous declaration 'long int random()'
 long _EXFUN(random,(_VOID));
      ^



So... still persists.
Posted By: Aku_Aku

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 08/12/16 20:52

I decided, i will upside down the sdk_engine/afuncs.h include file, and i commented out the marked line.
What a surprise! It runs!

Another surprise the arena.wmb mentioned in the example program does not exist.
Where can i find that file?

Finally, i have found, arena.wmb is built into the acknex.dll (somehow)

But there is another problem, the program is whinning immediatly the start, it misses the viewer.c

After struggling with copy lot of include files, it turned out arena.wmb is not in the dll, so can not open.
Interesting.
Posted By: Aku_Aku

Re: ackexe.cpp : Tutorial Application, Lesson 1 compiling problem - 08/13/16 21:19

Finally, somehow i induced Eclipse/GCC and 3DGS to work together.
Lesson1 and Lesson2 work well, with more or less modifications and hacks.
It turned out Lesson3 could work if Nvidia PhysX would installed.
In revealing this thing the message "Can't initialize PhysX" didn't help lot.
© 2024 lite-C Forums