# Unable to use MINGW's G++ to compile C++ code with DPI-C Export. 

**URL:** <https://verificationacademy.com/forums/t/unable-to-use-mingws-g-to-compile-c-code-with-dpi-c-export/51622>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, dpi-c, export-DPI-C\
**Created:** [May 18, 2026, 12:52pm UTC](https://verificationacademy.com/forums/t/unable-to-use-mingws-g-to-compile-c-code-with-dpi-c-export/51622 "2026-05-18T12:52:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_Lee\_KEYS](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@Justin\_Lee\_KEYS](https://verificationacademy.com/forums/u/Justin_Lee_KEYS)\
**Post date:** [May 18, 2026, 12:52pm UTC](https://verificationacademy.com/forums/t/unable-to-use-mingws-g-to-compile-c-code-with-dpi-c-export/51622/1 "2026-05-18T12:52:51Z")

</div>

Hi,

Newbie here. I have a file named dpi\_server.cpp and a systemverilog file named sv\_testbench.sv.  
Inside the sv\_testbench.sv, I have a function named and described as below:

```verilog
export "DPI-C" function sv_display_message;

function void sv_display_message(input string msg);
     $display("[SV:] At [%0t]: %s", $time, msg);
endfunction

```

and it is exported to dpi\_server.cpp with necessary adjustment being made

```cpp
#include "svdpi.h"

extern “C” void sv_display_message(const char* msg);

```

However, when I try to compile them in Questasim 10.6c terminal, with

```auto
g++ -shared -Bsymbolic -o dpi_server.dll dpi_server.cpp -L<installed_directory>\win64 -lmtipli -lws2_32 -static-libgcc -static-libstdc++

```

It will show me a compilation error stated that sv\_display\_message is unknown.

Hence, I would like to ask if there is any vlog and/or qverilog command which I can use to compile both cpp and sv file while also generating a usable .dll file.

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [May 18, 2026, 12:53pm UTC](https://verificationacademy.com/forums/t/unable-to-use-mingws-g-to-compile-c-code-with-dpi-c-export/51622/2 "2026-05-18T12:53:33Z")

</div>

This Siemens sponsored forum is not for tool related issues. Please refer to your tool documentation or contact your vendor support team for additional assistance.

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [May 18, 2026, 12:53pm UTC](https://verificationacademy.com/forums/t/unable-to-use-mingws-g-to-compile-c-code-with-dpi-c-export/51622/3 "2026-05-18T12:53:43Z")

</div>


