I'm creating an app to test an api func IsCharLowerA and then output res using MessageBoxA. I'm using masm32.
link /SUBSYSTEM:WINDOWS kod.obj
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
kod.obj : warning LNK4033: converting object format from OMF to COFF
kod.obj : error LNK2001: unresolved external symbol __ExitProcess#4
kod.obj : error LNK2001: unresolved external symbol __MessageBoxA#16
kod.obj : error LNK2001: unresolved external symbol __imp__printf
kod.obj : error LNK2001: unresolved external symbol __imp__scanf
kod.obj : error LNK2001: unresolved external symbol _IsCharLowerA#4
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
ml kod.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: kod.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/z2
"kod.obj"
"kod.exe"
NUL
LINK : warning LNK4044: unrecognized option "z2"; ignored
kod.obj : warning LNK4033: converting object format from OMF to COFF
LINK : fatal error LNK1181: cannot open input file "kod.exe"
I've tried to use microsoft masm32 (to compile code in visual studio), but when the app starts it's only ask for a char and then closes. I could not try to debug due to "source not available" error.
Some code:
.586
.model flat, stdcall
option casemap: none
include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
include C:\masm32\include\user32.inc
include C:\masm32\include\msvcrt.inc
includelib C:\masm32\lib\msvcrt.lib
includelib C:\masm32\lib\kernel32.lib
includelib C:\masm32\lib\user32.lib
.data
msg db 'Enter char: ', 0
messagebox_title db ' Лабораторна робота № 5 ', 0
result_0 db ' NOT LOWERCASE ', 0
result_1 db ' LOWERCASE ', 0
scan_modifier db '%c', 0
.data?
scan_res dd ?
.code
start:
push ebp
mov ebp, esp
invoke crt_printf, OFFSET msg
invoke crt_scanf, OFFSET scan_modifier, scan_res
push scan_res
call IsCharLowerA
push 0
push offset messagebox_title
cmp eax, 0
jne notNULL
push offset result_0
jmp next
notNULL:
push offset result_1
next:
push 0
call MessageBoxA
push 0
call ExitProcess
pop ebp
end start
Update #1: (changed MessageBoxA -> MessageBoxA#16 and others)
Code:
.586
.model flat, stdcall
option casemap: none
include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
include C:\masm32\include\user32.inc
include C:\masm32\include\msvcrt.inc
includelib C:\masm32\lib\msvcrt.lib
includelib C:\masm32\lib\kernel32.lib
includelib C:\masm32\lib\user32.lib
extrn MessageBoxA#16 : PROC
extrn ExitProcess#4 : PROC
.data
msg db 'Enter char: ', 0
messagebox_title db ' Лабораторна робота № 5 ', 0
result_0 db ' NOT LOWERCASE ', 0
result_1 db ' LOWERCASE ', 0
scan_modifier db '%c', 0
.data?
scan_res dd ?
.code
start:
push ebp
mov ebp, esp
invoke crt_printf, OFFSET msg
invoke crt_scanf, OFFSET scan_modifier, scan_res
push scan_res
call IsCharLowerA
push 0
push offset messagebox_title
cmp eax, 0
jne notNULL
push offset result_0
jmp next
notNULL:
push offset result_1
next:
push 0
call MessageBoxA#16
push 0
call ExitProcess#4
pop ebp
end start
Res:
link /SUBSYSTEM:WINDOWS kod.obj
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
kod.obj : warning LNK4033: converting object format from OMF to COFF
kod.obj : error LNK2001: unresolved external symbol _MessageBoxA#16
kod.obj : error LNK2001: unresolved external symbol __imp__printf
kod.obj : error LNK2001: unresolved external symbol _ExitProcess#4
kod.obj : error LNK2001: unresolved external symbol __imp__scanf
kod.obj : error LNK2001: unresolved external symbol _IsCharLowerA#4
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
kod.exe : fatal error LNK1120: 6 unresolved externals
I have a code error LNK2001: unresolved external symbol _MessageBox (uploaded #2 "Final working code") is not succeed linking too
The problems was:
1) For scanf needed OFFSET scan_res, because not value is needed.
2) Can not be compiled using both windows and console subsystem. That's why i used only printfs.
3) Was not enough library msvcrt.
4) Сonverting from OMF to COFF could be ignored.
Working code:
.586
.model flat, stdcall
option casemap: none
include C:\masm32\include\windows.inc
include C:\masm32\include\user32.inc
include C:\masm32\include\msvcrt.inc
includelib C:\masm32\lib\msvcrt.lib
includelib C:\masm32\lib\user32.lib
.data
msg db 'Enter char: ', 0
result_0 db ' NOT LOWERCASE ', 0
result_1 db ' LOWERCASE ', 0
scan_modifier db '%c', 0
.data?
scan_res dd ?
.code
start:
mov ebp, esp
invoke crt_printf, OFFSET msg
invoke crt_scanf, OFFSET scan_modifier, OFFSET scan_res
push scan_res
call IsCharLowerA
cmp eax, 0
jne notNULL
invoke crt_printf, OFFSET result_0
jmp next
notNULL:
invoke crt_printf, OFFSET result_1
next:
ret
end start
Related
I'm trying to view the Windows file system structure _FILE_ID_BOTH_DIR_INFORMATION in memory using WinDbg, but for some reason it tells me that the symbol is not found.
I connected WinDbg with a pipe to a Windows XP virtual machine in order to debug its kernel.
I tried viewing the structure's data using the command dt _FILE_ID_BOTH_DIR_INFORMATION esi because the value of ESI is an address which contains the structure in question that I want to inspect.
All I got was the following output:
3: kd> dt _FILE_ID_BOTH_DIR_INFORMATION esi
*************************************************************************
*** ***
*** ***
*** Either you specified an unqualified symbol, or your debugger ***
*** doesn't have full symbol information. Unqualified symbol ***
*** resolution is turned off by default. Please either specify a ***
*** fully qualified symbol module!symbolname, or enable resolution ***
*** of unqualified symbols by typing ".symopt- 100". Note that ***
*** enabling unqualified symbol resolution with network symbol ***
*** server shares in the symbol path may cause the debugger to ***
*** appear to hang for long periods of time when an incorrect ***
*** symbol name is typed or the network symbol server is down. ***
*** ***
*** For some commands to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: _FILE_ID_BOTH_DIR_INFORMATION ***
*** ***
*************************************************************************
Symbol _FILE_ID_BOTH_DIR_INFORMATION not found.
Other structures are working for me, like _DRIVER_OBJECT.
All I know about the _FILE_ID_BOTH_DIR_INFORMATION symbol is that it is included in ntifs.h, according to Microsoft's documentation. I couldn't find information regarding whether this symbol is provided from Microsoft Symbol Server.
no it appears this type info is not available in the public pdbs provided by ms
you can check yourself using wildcards
0: kd> dt nt!*_FILE_*
ntkrnlmp!_FILE_INFORMATION_CLASS
ntkrnlmp!_FILE_OBJECT
ntkrnlmp!_PF_FILE_ACCESS_TYPE
ntkrnlmp!_FILE_SEGMENT_ELEMENT
ntkrnlmp!_IOP_FILE_OBJECT_EXTENSION
ntkrnlmp!_CREATE_FILE_TYPE
ntkrnlmp!_FILE_OBJECT_EXTENSION_TYPE
ntkrnlmp!_DUMMY_FILE_OBJECT
ntkrnlmp!_IMAGE_FILE_HEADER
ntkrnlmp!_FILE_BASIC_INFORMATION
ntkrnlmp!_FILE_GET_QUOTA_INFORMATION
ntkrnlmp!_FILE_NETWORK_OPEN_INFORMATION
ntkrnlmp!_MMPAGE_FILE_EXPANSION
ntkrnlmp!_FILE_STANDARD_INFORMATION
ntkrnlmp!_MAPPED_FILE_SEGMENT
ntkrnlmp!_MMPAGE_FILE_EXPANSION_FLAGS
ntkrnlmp!_MI_PAGING_FILE_SPACE_BITMAPS
0: kd> dt nt!*_FILE_I*
ntkrnlmp!_FILE_INFORMATION_CLASS
as to view them you can view the Raw Contents of memory just do dd #esi
and corelate them with the Structure in ntifs.h
or use .printf and some find replace in notepad to print a formatted output
I just copy pasted the Structure From Documentation into notepad++
stuffed the .printf in front using find replace
stuffed the \t%x in the end using same procedure
tweaked the offsets to the PseudoRegister and saved it as .txt
used $$>a< to run it as windbg script providing a random offset to the Pseudo Register (just made sure there is some Unicode string at offset+0x48
the results are as below
r $t0 = (fffff805`19ec53e0-48)
.printf "typedef struct _FILE_ID_BOTH_DIR_INFORMATION { \n"
.printf " ULONG NextEntryOffset; \t%x\n" , #$t0+0
.printf " ULONG FileIndex; \t%x\n" , #$t0+4
.printf " LARGE_INTEGER CreationTime; \t%N\n" , #$t0+8
.printf " LARGE_INTEGER LastAccessTime; \t%N\n" , #$t0+10
.printf " LARGE_INTEGER LastWriteTime; \t%N\n" , #$t0+18
.printf " LARGE_INTEGER ChangeTime; \t%N\n" , #$t0+20
.printf " LARGE_INTEGER EndOfFile; \t%N\n" , #$t0+28
.printf " LARGE_INTEGER AllocationSize; \t%N\n" , #$t0+30
.printf " ULONG FileAttributes; \t%x\n" , #$t0+38
.printf " ULONG FileNameLength; \t%x\n" , #$t0+3c
.printf " ULONG EaSize; \t%x\n" , #$t0+40
.printf " CCHAR ShortNameLength; \t%x\n" , #$t0+44
.printf " WCHAR ShortName[12]; \t%mu\n" , #$t0+48
.printf " LARGE_INTEGER FileId; \t%N\n" , #$t0+54
.printf " WCHAR FileName[1]; \t%mu\n" , #$t0+58
.printf "} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION; \n"
results
0: kd> $$>a< f:\wdscr\fileid.wds
typedef struct _FILE_ID_BOTH_DIR_INFORMATION {
ULONG NextEntryOffset; 19ec5398
ULONG FileIndex; 19ec539c
LARGE_INTEGER CreationTime; FFFFF80519EC53A0
LARGE_INTEGER LastAccessTime; FFFFF80519EC53A8
LARGE_INTEGER LastWriteTime; FFFFF80519EC53B0
LARGE_INTEGER ChangeTime; FFFFF80519EC53B8
LARGE_INTEGER EndOfFile; FFFFF80519EC53C0
LARGE_INTEGER AllocationSize; FFFFF80519EC53C8
ULONG FileAttributes; 19ec53d0
ULONG FileNameLength; 19ec53d4
ULONG EaSize; 19ec53d8
CCHAR ShortNameLength; 19ec53dc
WCHAR ShortName[12]; KeRevertToUserGroupAffinityThread
LARGE_INTEGER FileId; FFFFF80519EC53EC
WCHAR FileName[1]; ToUserGroupAffinityThread
} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION;
crt_printf, crt_scanf, ExitProcess
Windows 7 with masm32v11r for Environment Path
in .asm file, I'd like to call crt_printf to print (or call ExitProcess to end main procedure). However my code goes with:
.386
.model flat,stdcall
option casemap:none
includelib D:\masm32\lib\msvcrt.lib
printf proto C:dword,:vararg
scanf proto C:dword,:vararg
.DATA
print_int DB "%d",0
print_char DB "%c",0
and my call procedure goes with:
PUSH offset __temp13#_cal#main
PUSH offset print_string
CALL crt_printf
ADD ESP, 8
PUSH _realCock#main
PUSH offset print_int
CALL crt_printf
ADD ESP, 8
PUSH offset __temp14#_cal#main
When I Click the button of build All, messages come with:
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: D:\masm32\bin\object_code.asm
D:\masm32\bin\object_code.asm(105) : error A2006: undefined symbol : crt_printf
D:\masm32\bin\object_code.asm(109) : error A2006: undefined symbol : crt_printf
D:\masm32\bin\object_code.asm(179) : error A2006: undefined symbol : crt_scanf
D:\masm32\bin\object_code.asm(249) : error A2006: undefined symbol : ExitProcess
Assembly Error
I've struggled with such error for 24 hours, Thx!
crt_printf is a special construct of the MASM32 developers to distiguish it from their macro printf. If you don't include \masm32\macros\macros.asm you don't need this special feature:
.386
.model flat,stdcall
includelib \masm32\lib\msvcrt.lib
includelib \masm32\lib\kernel32.lib
printf proto C :dword, :vararg ; msvcrt
ExitProcess proto STDCALL :DWORD ; kernel32
.DATA
fmt db "%s",10,0
hello db "Hello world!",0
.CODE
main PROC
push OFFSET hello
push OFFSET fmt
call printf
add esp, (2 * 4)
push 0
call ExitProcess
main ENDP
END main
The crt_... aliasses are declared in the msvcrt.inc:
.386
.model flat,stdcall
include \masm32\include\msvcrt.inc
includelib \masm32\lib\msvcrt.lib
includelib \masm32\lib\kernel32.lib
printf proto C :dword, :vararg ; msvcrt
ExitProcess proto STDCALL :DWORD ; kernel32
.DATA
fmt db "%s",10,0
hello db "Hello world!",0
.CODE
main PROC
push OFFSET hello
push OFFSET fmt
call crt_printf
add esp, (2 * 4)
push 0
call ExitProcess
main ENDP
END main
If you want the whole bunch with all declarations and macros then include masm32rt.inc:
include \masm32\include\masm32rt.inc
.DATA
fmt db "%s",10,0
hello db "Hello world!",0
.CODE
main PROC
push OFFSET hello
push OFFSET fmt
call crt_printf
add esp, (2 * 4)
printf ("Hello again: %s\n",OFFSET hello);
push 0
call ExitProcess
main ENDP
END main
I have a fortran subroutine, FortranShake, and a C++ main function, HandShakingTest.cpp.
I'm trying to call a fortran subroutine from CLR C++.
I'm getting two batches of errors. Let's call them ERROR(1) and ERROR(2). I'd really appreciate if you could help me understand why these errors are happening.
When I try to compile with the following:
cl /clr HandShakingTest.cpp
I get the following ERROR(1):
HandShakingTest.obj : error LNK2028: unresolved token (0A00030A) "extern "C" void __c
ecl FortranShake(int &)" (?FortranShake##$$J0YAXAAH#Z) referenced in function "int __
lrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#Sys
em###Z)
HandShakingTest.obj : error LNK2019: unresolved external symbol "extern "C" void __cd
cl FortranShake(int &)" (?FortranShake##$$J0YAXAAH#Z) referenced in function "int __c
rcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#Syst
m###Z)
HandShakingTest.exe : fatal error LNK1120: 2 unresolved externals
I then used the following commands to compile instead:
ifort /c FortranShake.f //Which compiles fine
cl /c /clr HandShakingTest.cpp //compiles fine
cl /o test HandShakingTest.obj FortranShake.obj //ERROR(2) occurs
ERROR(2) consists of:
MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(cla
ss type_info const &)" (??0type_info##AAE#ABV0##Z) already defined in LIBCMT.lib(typin
fo.obj)
MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_i
nfo::operator=(class type_info const &)" (??4type_info##AAEAAV0#ABV0##Z) already defin
ed in LIBCMT.lib(typinfo.obj)
MSVCRT.lib(merr.obj) : error LNK2005: __matherr already defined in LIBCMT.lib(_matherr
_.obj)
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NOD
EFAULTLIB:library
HandShakingTest.obj : error LNK2028: unresolved token (0A00030A) "extern "C" void __cd
ecl FortranShake(int &)" (?FortranShake##$$J0YAXAAH#Z) referenced in function "int __c
lrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#Syst
em###Z)
HandShakingTest.obj : error LNK2019: unresolved external symbol "extern "C" void __cde
cl FortranShake(int &)" (?FortranShake##$$J0YAXAAH#Z) referenced in function "int __cl
rcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#Syste
m###Z)
libifcoremt.lib(for_main.obj) : error LNK2019: unresolved external symbol _MAIN__ refe
renced in function _main
test.exe : fatal error LNK1120: 3 unresolved externals
Here's the HandShakingTest.cpp:
#include "stdio.h"
#include <stdlib.h>
#include <Windows.h>
#using <System.DLL>
#using <System.Windows.Forms.DLL>
using namespace std;
using namespace System;
using namespace System::IO;
using namespace System::Diagnostics;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
extern "C" {void FortranShake(int&);}
int main(array<System::String ^> ^args)
{
Process^ testHand = gcnew Process();
testHand->StartInfo->UseShellExecute = false;
testHand->StartInfo->RedirectStandardInput = true;
testHand->StartInfo->RedirectStandardOutput = true;
testHand->StartInfo->ErrorDialog = true;
int numDebug = 0;
String^ returnedDebug = "Nothing";
FortranShake(numDebug);
StreamReader^ FromHandProcess = testHand->StandardOutput;
StreamWriter^ ToHandProcess = testHand->StandardInput;
String^ Line;
Line = FromHandProcess ->ReadLine();
if (Line->Equals("Enter Hand") )
{
Console::WriteLine(L"Hand Started!");
}
ToHandProcess ->WriteLine(numDebug.ToString());
returnedDebug = FromHandProcess ->ReadLine();
MessageBox::Show(returnedDebug);
return 0;
}
Here is the Fortran Subroutine:
SUBROUTINE FortranShake(GP_DEBUG)
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
INN = 5
WRITE(06,'(a)') 'Enter Hand'
READ(INN,*) GP_DEBUG
GP_DEBUG = GP_DEBUG + 55
WRITE(06,*) GP_DEBUG
RETURN
END
Your first error is actually a linker error - without the /c command line switch you are compiling and linking in one step. No Fortran code or object code has been provided.
Your second error is because:
You have specified (through omission) mismatching runtime libraries for the C++ and the Fortran. You need to decide whether you want to use static linking (the default for the current (as of today, but not necessarily as of next month...) release of Intel Fortran on windows) or dynamic linking (the default for the MS C++ compiler). Perhaps add /MD to the ifort command line, which specifies dynamic linking.
Without compiler options or directives to the contrary, the equivalent identifier for the Fortran procedure in C code as generated by that Fortran compiler is an upper case variant of the Fortran procedure's name - i.e. in the C++ code call the procedure FORTRANSHAKE. If you can write your Fortran code to the F2003 standard, you should use the C interoperability features of that language (BIND(C,...)) to control the C binding name of the Fortran procedure and ensure calling conventions, etc align.
The dummy argument of the Fortran subroutine has the DOUBLE PRECISION type specifier, which is equivalent to double in the C++ for this combination of compilers, not int. Again, F2003 introduces features that can make this alignment of argument types more robust.
I'm trying to build Rebol3 in Windows (it's for work) via vcbuild.bat, and getting an unresolved externals error. Here's a snippet from the process, the error happens at the bottom there.
<snip for brevity...>
host-lib.c
dev-stdio.c
dev-event.c
dev-file.c
dev-clipboard.c
link.exe /nologo /DEBUG /RELEASE /opt:ref /opt:icf /LTCG objs/a-constant
s.obj objs/a-globals.obj objs/a-lib.obj objs/b-boot.obj objs/b-init.obj objs/c-
do.obj objs/c-error.obj objs/c-frame.obj objs/c-function.obj objs/c-port.obj ob
js/c-task.obj objs/c-word.obj objs/d-crash.obj objs/d-dump.obj objs/d-print.obj
objs/f-blocks.obj objs/f-deci.obj objs/f-enbase.obj objs/f-extension.obj objs/
f-math.obj objs/f-modify.obj objs/f-random.obj objs/f-round.obj objs/f-series.o
bj objs/f-stubs.obj objs/l-scan.obj objs/l-types.obj objs/m-gc.obj objs/m-pool
s.obj objs/m-series.obj objs/n-control.obj objs/n-data.obj objs/n-io.obj objs/n
-loop.obj objs/n-math.obj objs/n-sets.obj objs/n-strings.obj objs/n-system.obj
objs/p-clipboard.obj objs/p-console.obj objs/p-dir.obj objs/p-dns.obj objs/p-ev
ent.obj objs/p-file.obj objs/p-net.obj objs/s-cases.obj objs/s-crc.obj objs/s-f
ile.obj objs/s-find.obj objs/s-make.obj objs/s-mold.obj objs/s-ops.obj objs/s-
trim.obj objs/s-unicode.obj objs/t-bitset.obj objs/t-block.obj objs/t-char.obj
objs/t-datatype.obj objs/t-date.obj objs/t-decimal.obj objs/t-event.obj objs/t-
function.obj objs/t-gob.obj objs/t-image.obj objs/t-integer.obj objs/t-logic.ob
j objs/t-map.obj objs/t-money.obj objs/t-none.obj objs/t-object.obj objs/t-pair
.obj objs/t-port.obj objs/t-string.obj objs/t-time.obj objs/t-tuple.obj objs/t-
typeset.obj objs/t-utype.obj objs/t-vector.obj objs/t-word.obj objs/u-bmp.obj
objs/u-compress.obj objs/u-dialect.obj objs/u-gif.obj objs/u-jpg.obj objs/u-md5
.obj objs/u-parse.obj objs/u-png.obj objs/u-sha1.obj objs/u-zlib.obj objs/host-
main.obj objs/host-args.obj objs/host-device.obj objs/host-stdio.obj objs/dev-n
et.obj objs/dev-dns.obj objs/host-lib.obj objs/dev-stdio.obj objs/dev-event.obj
objs/dev-file.obj objs/dev-clipboard.obj user32.lib ws2_32.lib advapi32.lib sh
ell32.lib comdlg32.lib /PDB:r3.pdb /OUT:r3.exe /SUBSYSTEM:WINDOWS
Creating library r3.lib and object r3.exp
f-math.obj : error LNK2001: unresolved external symbol _signbit
r3.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BI
N\link.exe"' : return code '0x460'
Stop.
C:\r3\make>
I've got a copy of the r3 repo from here, and I'm using MSVS 2010, which uses the "Microsoft (R) 32-bit C/C++ Optmizing Compiler Version 16.00.30319.01 for 80x86", in case that matters.
make prep (with the Win32 edition of make) errors with
REBOL System Error #1405: REBOL System Error
Program terminated abnormally.
This should never happen.
Please contact www.REBOL.com with details.
What am I doing wrong? What's the source of the issue? Is there a workaround?
For a workaround*, include the following right after the last #include in f-math.c
#include <float.h>
int signbit(double x) {
return (x == 0) ? _fpclass(x) & _FPCLASS_NZ : x < 0;
}
Be aware, though, that with that little modification you won't be able to compile under mingw, in case you want to try that.
* From the Rebol and Red chat some time ago.
I'm having difficulty building a project in Windows 7 / Visual Studio 2010, and already spent longer than I would admit googling and fixing other errors to get to this point, but frustratingly I can't seem to get rid of the very last error. There is a linker error related to the _hypot function defined in math.h:
wxTheAppInitializer" (?wxTheAppInitializer##3VwxAppInitializer##A)
already defined in main.obj 1>libgsl.a(linalg_svd.o) : error LNK2019:
unresolved external symbol _hypot referenced in function
_gsl_linalg_SV_decomp 1>libgsl.a(matrix_oper.o) : error LNK2001: unresolved external symbol _hypot 1>libgsl.a(linalg_householder.o) :
error LNK2001: unresolved external symbol _hypot
: fatal error LNK1120: 1 unresolved externals
When I follow the advice of unresolved external symbol "_hypot" when using static library I get the following:
1> Generating Code... 1> main.obj : error LNK2005: _hypot already
defined in About.obj 1> fatal error LNK1169: one or more multiply
defined symbols found
Could anyone explain what is going on?
Create .c file with the following contents:
extern double fabs(double);
extern double sqrt(double);
double hypot(double x, double y) {
double ax = fabs(x), ay = fabs(y);
double xy = x/y, yx = y/x;
return ax > ay
? ax * sqrt(1.0 + yx*yx)
: ay * sqrt(1.0 + xy*xy);
}
do not include math.h