Gabriel Posted May 12, 2020 Report Share Posted May 12, 2020 Hi all, I'm trying to create a DLL for a simple SystemC model using Microsoft Visual C++ 2019. After building SystemC DLL (DebugDLL) and following MS doc to create a DLL, I'm having linking errors like: 1> Creating library <path>\SimpleLib\Debug\SimpleLib.lib and object <path>\simple\SimpleLib\Debug\SimpleLib.exp 1>SimpleLib.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sc_core::sc_module_name::~sc_module_name(void)" (__imp_??1sc_module_name@sc_core@@QAE@XZ) referenced in function "public: __thiscall myclass::myclass(class sc_core::sc_module_name)" (??0myclass@@QAE@Vsc_module_name@sc_core@@@Z) 1>SimpleLib.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sc_core::sc_simcontext::sc_simcontext(void)" (__imp_??0sc_simcontext@sc_core@@QAE@XZ) referenced in function "class sc_core::sc_simcontext * __cdecl sc_core::sc_get_curr_simcontext(void)" (?sc_get_curr_simcontext@sc_core@@YAPAVsc_simcontext@1@XZ) (attached complete log) What could be the problem? The code is the one from the post link: // SimpleLib.h #pragma once #ifdef SIMPLELIB_EXPORTS #define SIMPLELIB_API __declspec(dllexport) #else #define SIMPLELIB_API __declspec(dllimport) #endif #include <systemc.h> class SIMPLELIB_API myclass : public sc_core::sc_module { public: myclass(sc_core::sc_module_name name); void display(); }; //SimpleLib.cpp #include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier #include "SimpleLib.h" myclass::myclass(sc_core::sc_module_name name) : sc_core::sc_module(name) { std::cout << "Inside cons\n"; } void myclass::display() { std::cout << "Calling display\n"; } Configuration of the SimpleLib project was done also following INSTALL (Building against a SystemC DLL): C/C++ -> General -> Additional Include Directories is set to: <my_path>\systemc-2.3.3\src Added SC_WIN_DLL to: C/C++ -> Preprocessor -> Preprocessor Definitions Linker -> General -> Additional Library Directories is set to: <my_path>\systemc-2.3.3\msvc10\SystemC\DebugDLL log.txt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.