(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
04-26-24 09:23 PM
0 users currently in ROM Hacking.
Acmlm's Board - I3 Archive - ROM Hacking - Lunar Compress issues New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
Smallhacker

Super Koopa
I AM A Group Of Officially Frustrated Younglings, G.O.O.F.Y. MEMBER








Since: 11-17-05
From: Söderhamn, Sweden

Last post: 6279 days
Last view: 6276 days
Skype
Posted on 02-07-07 10:13 PM Link | Quote
This probably belongs in the Programming forum, but I believe that I'm more likely to get help in here.

Has anyone ever got the SMW program example in Lunar Compress to compile? I've tried three different compilers (Borland C++ Builder 5, Dev-C++ and M$ Visual C++ 6.0) and all of them complains about unsolved external references.

Here's the error messages from VC++:

--------------------Configuration: smw_example - Win32 Debug--------------------
Compiling...
smw_example.cpp
Linking...
smw_example.obj : error LNK2001: unresolved external symbol "unsigned int (__stdcall* LunarSNEStoPC)(unsigned int,unsigned int,unsigned int)" (?LunarSNEStoPC@@3P6GIIII@ZA)
smw_example.obj : error LNK2001: unresolved external symbol "int (__stdcall* LunarRender8x8)(unsigned int *,int,int,int,int,void *,unsigned int *,unsigned int,unsigned int)" (?LunarRender8x8@@3P6GHPAIHHHHPAX0II@ZA)
smw_example.obj : error LNK2001: unresolved external symbol "unsigned int (__stdcall* LunarSNEStoPCRGB)(unsigned int)" (?LunarSNEStoPCRGB@@3P6GII@ZA)
smw_example.obj : error LNK2001: unresolved external symbol "int (__stdcall* LunarCreatePixelMap)(void *,void *,unsigned int,unsigned int)" (?LunarCreatePixelMap@@3P6GHPAX0II@ZA)
smw_example.obj : error LNK2001: unresolved external symbol "int (__stdcall* LunarCloseFile)(void)" (?LunarCloseFile@@3P6GHXZA)
smw_example.obj : error LNK2001: unresolved external symbol "unsigned int (__stdcall* LunarDecompress)(void *,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int *)" (?LunarDecompress@@3P6GIPAXIIIIPAI@ZA)
smw_example.obj : error LNK2001: unresolved external symbol "int (__stdcall* LunarOpenFile)(char *,unsigned int)" (?LunarOpenFile@@3P6GHPADI@ZA)
smw_example.obj : error LNK2001: unresolved external symbol "bool __cdecl LunarUnloadDLL(void)" (?LunarUnloadDLL@@YA_NXZ)
smw_example.obj : error LNK2001: unresolved external symbol "bool __cdecl LunarLoadDLL(void)" (?LunarLoadDLL@@YA_NXZ)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/smw_example.exe : fatal error LNK1120: 10 unresolved externals
Error executing link.exe.

smw_example.exe - 11 error(s), 0 warning(s)


Does anyone know what the problem is?


(edited by Smallhacker on 02-07-07 04:14 PM)
Stifu









Since: 11-18-05
From: Your mom's bed

Last post: 6278 days
Last view: 6276 days
Posted on 02-07-07 10:21 PM Link | Quote
I didn't spend much time on it, but if I remember right, it's just that the program isn't complete. It doesn't have a "main"...
1337_Ac3

Shyguy


 





Since: 04-22-06
From: sweden

Last post: 6285 days
Last view: 6278 days
Posted on 02-07-07 10:50 PM Link | Quote
Originally posted by Stifu
I didn't spend much time on it, but if I remember right, it's just that the program isn't complete. It doesn't have a "main"...

The one i got has a main (win api main), but it wont compile because i get the undefined reference to *function* and i'm using codeblocks. If someone could please make some kind of documention on how to get the stuff running it would be cool, because i kinda need it..
Cellar Dweller +

Red Koopa









Since: 11-18-05
From: Arkansas

Last post: 6286 days
Last view: 6277 days
Posted on 02-08-07 05:34 AM Link | Quote
It looks like part of the problem is that the functions in the DLL are C style and the main program is trying to call C++ style functions. To support function overloading, methods, and as a layer of error checking, C++ mangles the names of functions in the object file in a way that encodes the function's return and argument types. Therefore, the linker can't resolve the function symbols. If you are sure that you have directed your IDE to import functions from the DLL, try changing:
#include "../DLLCode/LunarDLL.h"
into:
extern "C" {
#include "../DLLCode/LunarDLL.h"
}
in smw_example.cpp. If your IDE isn't importing from the DLL, which could also cause this problem, then I can't help much.

It also looks like Smallhacker's IDE is trying to build the program as a console app based on the fact that the linker is looking for a "main" function. I haven't programmed for Windows in a long time, so I'm not equipped to explain how to fix that.
Smallhacker

Super Koopa
I AM A Group Of Officially Frustrated Younglings, G.O.O.F.Y. MEMBER








Since: 11-17-05
From: Söderhamn, Sweden

Last post: 6279 days
Last view: 6276 days
Skype
Posted on 02-08-07 12:34 PM Link | Quote
Originally posted by Cellar Dweller +
try changing:
#include "../DLLCode/LunarDLL.h"
into:
extern "C" {

#include "../DLLCode/LunarDLL.h"
}
in smw_example.cpp.

Hm... Nope. Still the same problem.
T.Geiger

Goomba


 





Since: 11-18-05
From: Indianapolis, IN, USA

Last post: 6287 days
Last view: 6279 days
Posted on 02-08-07 02:22 PM Link | Quote
The error messages you are getting are usually caused by a lack of a linking reference to an external DLL. It is not enough to merely include the header file, you must also dig into the application settings and figure out where libraries are linked. I do not have a C compiler in front of me, so I cannot tell you exactly where to go, but compilation errors work really well in Google.
Cellar Dweller +

Red Koopa









Since: 11-18-05
From: Arkansas

Last post: 6286 days
Last view: 6277 days
Posted on 02-09-07 07:53 AM Link | Quote
I got it to work on my brother's Windows machine. For some wierd reason, FuSoYa didn't provide an import library like a DLL author normally would. You can add LunarDLL.cpp to the project and it will load and call the DLL.
1337_Ac3

Shyguy


 





Since: 04-22-06
From: sweden

Last post: 6285 days
Last view: 6278 days
Posted on 02-09-07 04:08 PM Link | Quote
Originally posted by Cellar Dweller +
I got it to work on my brother's Windows machine. For some wierd reason, FuSoYa didn't provide an import library like a DLL author normally would. You can add LunarDLL.cpp to the project and it will load and call the DLL.

Wow, thanks for making me feel like the biggest idiot in the whole world. How come i didn't think of that...
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6277 days
Last view: 6276 days
Posted on 02-09-07 05:21 PM Link | Quote
lack of experience? ignorance? need we go on?

p.s. btw programs don't need a main( ) if they are windows apps. They use winmain( ). And if they use MFC the winmain( ) is even hidden. I had that pain the ass the other day trying to figure out the source of some program I downloaded.
1337_Ac3

Shyguy


 





Since: 04-22-06
From: sweden

Last post: 6285 days
Last view: 6278 days
Posted on 02-09-07 11:45 PM Link | Quote
Originally posted by MathOnNapkins
lack of experience? ignorance? need we go on?

p.s. btw programs don't need a main( ) if they are windows apps. They use winmain( ). And if they use MFC the winmain( ) is even hidden. I had that pain the ass the other day trying to figure out the source of some program I downloaded.


No, no, no.

Wow, your post was so totaly uncalled for.. And yes, anyone who has some kind of common sense should be able to figure out what winmain() replaces....... Arr, well, this looks like dry grass with fuel for a flamewar so let's stop.


(edited by 1337_Ac3 on 02-09-07 05:46 PM)
(edited by 1337_Ac3 on 02-09-07 05:50 PM)
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - ROM Hacking - Lunar Compress issues |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.016 seconds; used 397.94 kB (max 495.64 kB)