Tips
- dfor.lib Link error LNK2005 in Visual C++ & Visual Fortran.
The link error as:
dfor.lib(matherr.obj) : error LNK2005: __matherr already defined in LIBCD.lib (matherr.obj)
Answer: Make sure you place "dfor.lib" after all user libraries and before system libraries in menu "project"/"setting" => "link" => "Object/library modules".
-
LIBCD.lib error LNK2005 ... libc.lib in Visual C++ & Visual Fortran. .
Answer: ignore "libc.lib" in link of setting.
dumpbin /symbols aa.obj to get real interfaces in aa.obj.
-
Two dimension array in c/c++, and its calling by fortran code.
In C++ to dynamically create a two (or high) dimension array, the
definition should be like:
float
(*aaa)[100] = new float[nsize][100];
When pass above array in function, the real format in C/C++ is "funcs(float[][100]);" but not " funcs(float**);".
So to call this function in Fortran, it must be passed as two dimensional array, but can not be passed as pointer's pointer.
Here is an example in Fortran:
subroutine funcs(aaa)
aaa(100, nsize)
...
end
-
Runtime error R6002: "floating-point support not loaded" in Visual C++. .
Resolution: Initialize the floating-point variable or use the variable in an expression in the routine that contains the scanf() call.
Link c++ and fortran in GNU (or SUN) C++ & F77.
- (1) by g++:
- g++ *.o -o exe -lg2c -lm ## -lg2c must be after *.o; or use -lf2c
- (2) by f77 (or g77)
- f77 -lstdc++ *.o -o exe
-
Incompatibles in Visual Fortran with GNU (SUN) F77.
- Can not use Rewind in binary file.
- recl in open(...) should be 1/4 of the file size, but be the file size in other f77.
- ... ... ... ...(too many)
-
fseek/ftell problem for text mode in files of Unix & Dos ascii format.
- If fseek/ftell is used in C/C++ program, the text file opened by the program should have same plateform format as the executive program. e.g., the program is compiled in win/dos, the opened ascii file should be in dos ascii format.
-
Incompatibles in Visual C/C++ with GNU (SUN) C/C++.
- To open a binary file, mode "b" must be used in fopen of Visual C/C++.
- To open a binary file, mode "ios::binary" must be used in fstream of Visual C/C++.
- ... ... ... ...(too many)
|