I've been trying to compile a simple System C executable under windows 10 bash without success, after some search, I've found this link: http://topazus-dev.blogspot.com/2016/06/systemc-on-windows-using-bash-on-windows.html Explaining that dynamic linking does not work correctly under Windows 10 bash, so a workaround is to use static linking, I've tried compiling the following example program:
#include <systemc.h>
#include <iostream>
int sc_main(int argc, char** argv)
{
std::cout << "Hi\n";
return 0;
}
The program itself is not important, the point is to be able to compile it, the commands I used were:
g++ -Wall -g -I/mnt/c/home/systemc-2.3.2/include -c -o main.o main.cpp
g++ main.o -L /mnt/c/home/systemc-2.3.2/lib-linux64 -Wl, -Bstatic -lsystemc -Wl, -Bdynamic -pthread -o main
But the process fails and the following error appears:
/usr/bin/ld: cannot find : No such file or directory /usr/bin/ld: cannot find : No such file or directory collect2: error: ld returned 1 exit status
I've compiled programs with other libraries besides System C, they work as expected, I've also tried to compile directly with the .a version of System C present on the same folder as the .so, that caused a lot undefined references in the linking process, so it doesn't work that way either.
Thanks in advance.