C library and C++ application
-
Hi there! My project looks like this: #1 - libiupwin.lib - library written completely in C #2 - app.exe - application written in C++ - depends on libiupwin.lib The problem: I can compile #1, and a .lib file is generated I can compile #2, but linker fails with plenty of messages like: Unresolved external '_iupDlgNext' referenced from (...)\libiupwin.lib|itraverse "itraverse" is one of C files included in library, and iupDlgNext is of course a function (placed in library, too). I found one instance of 'iupDlgNext' and one instance of '_iupDlgNext' in a .lib file (using a text search). I guess this has something to do with differences between C and C++ function calls, but since I have little experience with "linking problems" I could use some help with this one. Thanks in advance. [ CoY0te ] Coyotus incrediblus...
-
Hi there! My project looks like this: #1 - libiupwin.lib - library written completely in C #2 - app.exe - application written in C++ - depends on libiupwin.lib The problem: I can compile #1, and a .lib file is generated I can compile #2, but linker fails with plenty of messages like: Unresolved external '_iupDlgNext' referenced from (...)\libiupwin.lib|itraverse "itraverse" is one of C files included in library, and iupDlgNext is of course a function (placed in library, too). I found one instance of 'iupDlgNext' and one instance of '_iupDlgNext' in a .lib file (using a text search). I guess this has something to do with differences between C and C++ function calls, but since I have little experience with "linking problems" I could use some help with this one. Thanks in advance. [ CoY0te ] Coyotus incrediblus...
If you have a header file for this library, you might need to add some lines like this at the top: #ifdef _cplusplus extern "C" { #endif and lines like this at the bottom #ifdef _cplusplus } #endif rebuild your C++ components, then see if it links okay.
-
Hi there! My project looks like this: #1 - libiupwin.lib - library written completely in C #2 - app.exe - application written in C++ - depends on libiupwin.lib The problem: I can compile #1, and a .lib file is generated I can compile #2, but linker fails with plenty of messages like: Unresolved external '_iupDlgNext' referenced from (...)\libiupwin.lib|itraverse "itraverse" is one of C files included in library, and iupDlgNext is of course a function (placed in library, too). I found one instance of 'iupDlgNext' and one instance of '_iupDlgNext' in a .lib file (using a text search). I guess this has something to do with differences between C and C++ function calls, but since I have little experience with "linking problems" I could use some help with this one. Thanks in advance. [ CoY0te ] Coyotus incrediblus...
The usual problem is that C linking is not specifed in the C header files. Therefor, the linker mangles the name found in the header file. #ifdef __cplusplus extern "C" { #endif /* C-Funcion prototypes */ #ifdef __cplusplus } #endif The error message you show does not seem to imply that this is the problem, but it is well worth checking out. Note: A function name mangled with an underscore in the error message is just the internal name of the function generated by the compilier (you may ignore the underscore). If you had named you function _Func the the error message would have called it __Func. Remember leading underscores are supposed to be reserved for vender/specific global variable/function names. Well I do not know it this helped. Good Luck! INTP
-
Hi there! My project looks like this: #1 - libiupwin.lib - library written completely in C #2 - app.exe - application written in C++ - depends on libiupwin.lib The problem: I can compile #1, and a .lib file is generated I can compile #2, but linker fails with plenty of messages like: Unresolved external '_iupDlgNext' referenced from (...)\libiupwin.lib|itraverse "itraverse" is one of C files included in library, and iupDlgNext is of course a function (placed in library, too). I found one instance of 'iupDlgNext' and one instance of '_iupDlgNext' in a .lib file (using a text search). I guess this has something to do with differences between C and C++ function calls, but since I have little experience with "linking problems" I could use some help with this one. Thanks in advance. [ CoY0te ] Coyotus incrediblus...
I've managed to solve my problem yesterday. I can't really tell what it really was, but it seem to me like a page size problem. Library had a page size increased to 64 since it was too large. I have created three libraries out of this one and left efault page size (16). Now it links juzt fine. Since I created new project, I'm not quite sure if something else didn't get involved, but perhaps it really was the page size. So in cae anybody runs into similar problem this may be the hint. Thanks for help. [ CoY0te ] Coyotus incrediblus...