Hello lzSun
On 17.09.2018 11:30, lzSun wrote:
Hello, I want to build a component which needs both C++ and C files, however, I encountered some problem when I compiling them together. Here's the error: libc.lib.so: undefined reference to `Libc::Component::construct(Libc::Env&)' collect2: error: ld returned 1 exit status
In a Genode component using the libc, the function Libc::Component::construct() is required. It is there to initialize some things that are needed by libc programs (eg. the command line parameters).
There are two methods to to provide this function: - link the posix library to your component - write it yourself
The posix library is a wrapper that provides the Libc::Component::construct() function and calls the main() method of the program, after setting up some variables that are normally needed by posix programs.
Best regards, Pirmin