- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We have a C project that calls a fortran library. This fortran library is created from a separate project that we've made-- myFortranLibrary.lib. We compiled the fortran library without error. We placed this library into the C project's directory. But when webuild the C project, we get the following error:
Error1fatal error LNK1181: cannot open input file 'ifconsol.lib'
this is the only error we get. We checked the manual and tried both the listed options: 1) setting "Disable Default Library Search Rules" to No, and not listing 'ifconsol.lib' or 'libifcore.lib' under "Additional Dependencies" in the C project, and 2) setting "Disable Default Library Search Rules" to Yes, and listing, 'ifconsol.lib' and 'libifcore.lib' under "Additional Dependencies". However, both of these cases result in the above error message.
Any ideas? Thank you.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We did as you sugggested. We now get the following error message:
Error23fatal error LNK1104: cannot open file 'IFWIN.LIB'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
I have joined in the effort - here is what we have gotten to:
We have a C program - calling a Fortran created Lib - we changed the lib creation settings to add: under libraries yes to common windows libraries and yes to Portlib
and we added the lib you had for the search lib
This removed all errors for Fortran
We also have a security lib we link to that had many errors (missing functions) - by googling, we found the libraries that have the functions and removed all those errors.
The library line is:
SKeyLN32.lib Ws2_32.lib Netapi32.lib Mpr.lib FB-multipier_lib.lib
FB_Mul.. is our Fortran lib
SkeyLN32 is the security and (Ws2_32.lib Netapi32.lib Mpr.lib) were needed to resolve external problems.
We are almost there!
The last error is:
Error2error LNK2001: unresolved external symbol _WinMain@16LIBCMT.lib
This program has a main funciton which calls the security function and then the fortran function.
here is the main function fragment:
#include
#include
#include
#include
"Valid_Eng.h"extern
void fbpier_lib(long* lLicenseID, int* bDemo, long* ncmarg, long* ngridmax, char* cmdstr );void
main(int argc, char* argv[])What are we missing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
I realized that the setting was for a windows program - but this is a console app!
I re-set to a console app and we are OK
On to the next problem - may get back to you
Marc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK,
Final problem:
We have a Fortran program - calling a C library (the C library is used as an interface to get an open file dialog)
When we link the programs we get:
Error675 error LNK2005: ___lookuptable already defined in LIBCMT.lib(output.obj)FB-MultiPier
Error676 error LNK2005: ___wnullstring already defined in LIBCMT.lib(output.obj)FB-MultiPier
So: How do we avoid the conflict? (I can not find the functions in any library)
Is there a simple way to call the open file dialog from quickwin (to replace the C call?)
Thanks
Marc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The answer is 'yes'. An example:
USE DFLIB
USE DFWINTY
USE DFWIN
IMPLICIT NONE
! Define an OPENFILENAME structure (see Help for GETOPENFILENAME)
TYPE (T_OPENFILENAME) FRED
INTEGERKIND=4) IRET
! DEFINE YOUR FILTER LENGTH AND DIMENSION
CHARACTER(LEN=22)FILTER(3)
CHARACTER($MAXPATH)FILENAME, STARTDIR,DLGTITLE
!* SET UP FILE SEARCH FILTERS TO APPEAR IN SEARCH BOX
! These must appear in pairs, the list terminated wih a null entry
!so the array FILTER must be dimensioned an odd number
! Note that the filter entriesmust be a null-terminated C-strings
!The characters between the quotes+1 for the null character mustbe equal to or less
! than the length defined for the FILTER elements
FILTER(1) = "My files (*.XYZ)"C
FILTER(2) = " *.XYZ"C
FILTER(3) = ""C
! SET UP START DIRECTORY FOR SEARCH.
! Note itmust be a null-terminated C-string
STARTDIR='My_start_directory'C
! SET THE OPENFILE DIALOG TITLE, also a null-terminated C-string
DLGTITLE='Looking for my file'C
! GET THE HANDLE OF THE MAIN APPLICATION WINDOW SO THAT THE FILEOPEN
! DIALOG BOX CAN BE ATTACHED TO IT BY SPECIFYING THE APPLICATION WINDOW
! AS THE OWNER USINGGETHWNDQQ
FRED%HWNDOWNER = GETHWNDQQ (QWIN$FRAMEWINDOW)
FRED%HINSTANCE = NULL
FRED%LPSTRFILTER = LOC(FILTER(1))
FRED%LPSTRCUSTOMFILTER = NULL
FRED%NMAXCUSTFILTER = NULL
FRED%NFILTERINDEX = 1
FRED%LPSTRFILE = LOC(FILENAME)
FRED%NMAXFILE = LEN(FILENAME)
FRED%LPSTRFILETITLE = NULL
FRED%NMAXFILETITLE = NULL
FRED%LPSTRINITIALDIR = LOC(STARTDIR)
FRED%LPSTRTITLE = LOC(DLGTITLE)
! choose your own flags - see Help for options
! combine them using multiple IOR's if necessary
FRED%FLAGS = IOR(OFN_FILEMUSTEXIST,OFN_PATHMUSTEXIST)
FRED%NFILEOFFSET = NULL
FRED%NFILEEXTENSION = NULL
FRED%LPSTRDEFEXT = NULL
FRED%LCUSTDATA = NULL
FRED%LPFNHOOK = NULL
FRED%LPTEMPLATENAME = NULL
FRED%LSTRUCTSIZE = SIZEOF(FRED)
! Start the get/open file dialog
IRET = GETOPENFILENAME(FRED)
! If you selected a file and pressed the OK button, IRET will be non-zero
! so test it
! FILENAME should then contain the selected file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By default, compiler inserts "hyperlinks" or "hints to the linker" into .obj files to the .lib file associated with the setting specified in Properties/Libraries/Run-time library. If those settings are inconsistent in various .objs and .libs you build together, you'll get a conflict, as above. /Zi or /libdir:noauto prevents insertion of those "hints", leaving the ultimate choice of run-time library to the .exe's project.
See Steve's article on Multiple C library syndrome for details... oh, no, it's gone again. Steve?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. We tried doing this but to no avail. We weren't sure exactly where to add /Zi, so we added it to the OpenF property pages, under Configuration Properties->C/C++->CommandLine, under Additional options. However, when we did this and rebuilt the project, we got the same error messages as before.
In the property pages for our fortran library (the one we created), /Zi is already listed, under Configuration Properties/Fortran/Command Line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. Any suggestion on exactly how to implement this? We will try to do the following steps:
-Create a new file with your code, customized to our project (replacing 'Fred' with our own reference). We will put the filename in the argument list for this routine.
- Include this file name in our project, so that it can be called, as a routine.
- call thisroutine from our existing code, supplying thefile name in the argument list, to receive the user's selection.
Please let us know if we should be doing something else/differently. Thank you again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JugoslavDujic:
See Steve's article on Multiple C library syndrome for details... oh, no, it's gone again. Steve?
Old forum bookmarks are no longer valid. Did I ever post the MCLS article? (The original was by Lorri Menard and updated by Peter Karam.) I'm typing this from an airport, so I'll post the MCLS article when I return to work next Wednesday.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We've implemented this, with your code nearly verbatim. We did make the following changes:
FILTER(1) = "Input Files (*.in)"C
FILTER(2) = "AllFiles *.*"C
Problem is that no files of type .in (or any other files) are displayed in the dialog. I've double checked to make sure there are .in files at the locations we are browsing to, and the .in files are indeed present.
Any thoughts? Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
..and the reason is because you broke the code by making your changes. You are trying to search for files with the search string 'All files *.*' !
Examine what I posted and you will see that all you need to do is change 'XYX' to 'IN' (adding an extra space somewherein the character strings to keep the lengths the same). The first entry, FILTER(1) displays a description of the files, he second, FILTER(2) is the search string, so if you change the search string back to *.in it should work. If you want to have an 'All files'option, add two more elements to FILTER, redimensioning it as FILTER(5), making FILTER(3) ='All files (*.*)'C and FILTER(4)=' *.*'C and moving the termination string to FILTER(5).
If you want to select 'All files' in the search box as default,set FRED%nfilterindex=3.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a tiny nit ... the command line switch is /Zl (capital Z lowercase L) not /Zi
/Zi means "debug"
- Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Problem fixed!!
We cannot thank you enough for all the quick and helpful responses.
Thanks!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page