hey there guys, i have problems with compiling an app with libv2 1.5 library. after linking the tune.obj (the object file that has a v2m with newer version) and initiating the v2m library , i get this error :
bones.obj : error LNK2001: unresolved external symbol __FPinit
libv2simple.lib(v2mplayer.obj) : error LNK2001: unresolved external symbol __fltused
libv2simple.lib(ronan.obj) : error LNK2001: unresolved external symbol __fltused
any suggestions ?
missing crt / msvcrt libraries?
got a different error after inserting msvcrt library :
libcmt.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
libcmt.lib(a_env.obj) : error LNK2001: unresolved external symbol __imp__GetEnvironmentStrings@0
__imp__GetEnvironmentStrings@0 needs a kernel32.lib
unresolved external symbol _main means you have to provive a main function or WinMain depending linker /SUBSYSTEM:CONSOLE or /SUBSYSTEM:WINDOWS flags
check those.
i've also inserted kernel32.lib and set the linker as /SUBSYSTEM:WINDOWS and still doesn't work.
well guys, i'm gonna attach the v2mplayer i've got from a friend (with libv2 1.5 library) and if you please, tell me how can i initiate it correctly , like i mean, what libs do i need in order to play the v2m correctly . i really need it for newer v2m's , and i have no luck when using it... :undecided:
umm... has anyone solved this yet ?
This is messy. The linker wants libcmt.lib, but when you supply that 14MB behemoth e.g. from here (https://github.com/Aekras1a/Labs/blob/master/Labs/WinDDK/7600.16385.1/lib/Crt/i386/libcmt.lib), it finds out that oldnames.lib is missing...
You may find both here (or similar locations):
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\oldnames.lib
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\libcmt.lib
Next stumbling block is then:
;; tune.obj is added in the linker command line
externdef c theTune:byte
There is no tune.obj in your archive :cool:
Make me wiser here, what does this topic have to do with assembler language programming for Windows ? As it looks like a C programming question, should it not be posted in a C/C++ forum elsewhere ?
The project is a RadASM asm (masm) project that calls the v2m .lib for playing converted music of .v2m type to an .obj file - the obj file (tunes.obj, created with the included bat file) is linked into the exe. The v2m .lib was probably compiled with some msvcrt runtime, hence the errors when linking and requiring some additional msvc libs as well to get it to function correctly for masm projects.
Quotelibv2simple.lib(v2mplayer.obj) : error LNK2001: unresolved external symbol __fltused
use fake _fltused
_fltused dw 0
for linker
/NODEFAULTLIB
use msvcrt.lib from masm32 package or create of your own
without compiler CRT
#pragma comment(lib, "kernel32.lib")
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "msvcrt.lib")
#pragma comment(lib, "libv2simple.lib")
#pragma comment(lib, "dsound.lib")
#pragma comment(linker, "-subsystem:console")
#ifdef __POCC__
#pragma comment(linker, "-nodefaultlib")
#pragma comment(linker, "tune.obj")
#endif
extern char theTune;
void __stdcall ExitProcess(int);
void* __stdcall GetForegroundWindow(void);
short __stdcall GetAsyncKeyState(int);
void __stdcall Sleep(int);
int __cdecl printf(const char *format, ...);
void __stdcall V2MInit(char *pTune, void *hWnd);
void __stdcall V2MClose(void);
void __stdcall V2MPlay(void);
int _fltused;
#define VK_ESCAPE 0x1B
void __cdecl mainCRTStartup(void)
{
printf("Now Playing: 'Patient Zero' by Melwyn & Little Bitchard\n");
V2MInit(&theTune, GetForegroundWindow());
V2MPlay();
while (1) {
if (GetAsyncKeyState(VK_ESCAPE)) break;
Sleep(10);
}
V2MClose();
ExitProcess(0);
}
EDIT msvc friendly source code
@ECHO OFF
SET VS=C:\code\msvc2019
SET LIB=C:\code\WDDK710\lib
%VS%\bin\cl -GS- -MD Test_libv2simple.c tune.obj
PAUSE
V2 synthesizer system (http://www.1337haxorz.de/products.html)
IT seems you use the old CRT.
This one used extern or intern data that you must insert in your source with the good declaration.
To find the needed declarations you can search in the source code of the crt of an old SDK.
MSDN seems to have not keep those informations.
__FPinit is the dword who allow to use the CPU (math processor) .
I have keep this one in my source code.
Quote
EXTERNDEF _FPinit:dword ; to load floating point library
Quote from: TouEnMasm on November 27, 2020, 07:00:35 PM
IT seems you use the old CRT.
A that msvcrt.lib refers to OS msvcrt.dll
Quote from: TouEnMasm on November 27, 2020, 07:00:35 PM
__FPinit is the dword who allow to use the CPU (math processor) .
EXTERNDEF _FPinit:dword ; to load floating point library
That example don't use that _FPinit
extern char theTune;
#pragma comment(linker, "tune.obj")
refer to that tune.obj, that r0ger gave.
Quote from: fearless on November 27, 2020, 03:36:46 PMtunes.obj, created with the included bat file
I had not seen that one, thanks.
I have try to recompile the sample,only problem "externdef c theTune:byte " is unknown.
I have searched the library,not FOUND,that ALL
There is also a conflict of library (link can solve that
Need also to know if you use masm32 package of the forum ?.
alright guys , i've finally solved the problem :
the problem was that the msvcrt library was old from the package so i've downloaded the new library from here (https://github.com/Aekras1a/Labs/blob/master/Labs/WinDDK/7600.16385.1/lib/Crt/i386/msvcrt.lib) . ( TouEnMasm is absolutely right about it )
thanks all of you for all your help now the v2m is working like a charm :biggrin: