Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

unresolved external symbol #12

Closed
avilleret opened this issue Jun 23, 2015 · 8 comments
Closed

unresolved external symbol #12

avilleret opened this issue Jun 23, 2015 · 8 comments

Comments

@avilleret
Copy link
Contributor

When building with MIcrosoft Visual Studio 2013, I experienced those errors :

Error   1   error LNK2019: unresolved external symbol _namelist_append_files referenced in function _pd_library_add_folder  D:\jamoma\build-Jamoma-win32\Implementations\PureData\library\CicmWrapper.lib(ecommon.obj)  JamomaPd
Error   2   error LNK2019: unresolved external symbol _sys_searchpath referenced in function _pd_library_add_folder D:\jamoma\build-Jamoma-win32\Implementations\PureData\library\CicmWrapper.lib(ecommon.obj)  JamomaPd
Error   3   error LNK2001: unresolved external symbol _sys_searchpath   D:\jamoma\build-Jamoma-win32\Implementations\PureData\library\CicmWrapper.lib(eobj_handle.obj)  JamomaPd
Error   4   error LNK2019: unresolved external symbol __imp__sys_staticpath referenced in function _pd_library_add_folder   D:\jamoma\build-Jamoma-win32\Implementations\PureData\library\CicmWrapper.lib(ecommon.obj)  JamomaPd

I'm using the pd.lib from Pd-0.46-6 and got the same with the library from 0.46-0.
The same code build fine on Unix.

How can I resolve this ?

@pierreguillot
Copy link
Member

Recently, I've changed a lot things of the library and in the file edefine.h you should find this :
EXTERN t_namelist *sys_staticpath;
EXTERN t_namelist *sys_externlist;
EXTERN t_namelist *sys_searchpath;
EXTERN t_namelist *sys_helppath;
EXTERN t_namelist *namelist_append_files(t_namelist *listwas, const char *s);
Miller uses extern instead of EXTERN but extern is not valid on Visual Studio, so I had changed header files but it's not a good practise (and it was the reason why I've put the header files in the library #11). With the latest version, I put these lines in the library, it should work with any header files (later, I'll try to contact Miller to see if he can directly change it in PD).

@avilleret
Copy link
Contributor Author

Oups, I should have made a pull before the report... sorry
I'll check it asap
Btw EXTERN is a macro reaplace with __declspec(dllimport) extern on windows for externals.
And I think Miller don't use this Macro on those symbols because there were not intended to be use in externals at first I guess.
But they do appear in some externals in Pd repo (like import and libdir), but I'm not sure they have been built with MSVC.

@avilleret
Copy link
Contributor Author

I still have the same undefined symbols with ba2ad8c and Microsoft Visual C++ 2013

@pierreguillot
Copy link
Member

I didn't have time to test with MVC. When I use MVC, I generate pd.lib and pd.def with pd.dll and it works. Perhaps the default Pd distribution does not have the symbols. Anyway, I check MVC to remove the symbols. This is temporary but I don't find any better solution right now.

@pierreguillot
Copy link
Member

ThomasLeMeur has done the MVC project (rc 2015 demo) for the Cream Library, he uses directly the .lib and .def from PD 0.46 and there isn't any problem. Can you try it ?

@avilleret
Copy link
Contributor Author

The solution doesn't work with MVC 2013 nor rc 2015.
Btw the project is made for MVC 2010.
But this is another issue, please look at : CICM/CreamLibrary#16

@avilleret
Copy link
Contributor Author

I succeed to build with Mingw-w64 on Linux by linking against .dll instead of .lib.
I think this is what @pierreguillot did with MVC and this should be the solution to close this issue.

@pierreguillot
Copy link
Member

You can't link against .dll with MVC but the solution is to "recreate" the .lib with all the symbols :
https://adrianhenke.wordpress.com/2008/12/05/create-lib-file-from-dll/
I will create a small release with the .lib and .def for MVC if people doesn't to do it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants