undefined reference to `main' when trying to build via OMK

Saeed Ehteshamifar salpha.2004 at gmail.com
Sat Aug 20 08:21:20 UTC 2016


Hello Pavel,

You're right: changing the extension to .cc made it work, even without
protecting Init task in my case.

Best Regards,
Saeed

On Thu, Aug 18, 2016 at 2:42 AM, Pavel Pisa <ppisa4lists at pikron.com> wrote:

> Hello Saeed,
>
> On Wednesday 17 of August 2016 21:47:31 Saeed Ehteshamifar wrote:
> > I had no main(). I was using Init() for C++ and C version as well.
>
> I have checked RTEMS OMK rules with C++ application and it works
> for me.
>
> Makefile.omk
> -------------------------------------------------------
> bin_PROGRAMS = appcpptest
>
> #lib_LIBRARIES =
>
> #include_HEADERS =
>
> appcpptest_SOURCES += init.cc task_1.cc test.c
>
> #appfoo_EMBEDTARFILES = rootfs
>
> lib_LOADLIBES += bar
> -------------------------------------------------------
>
> I have to protect Init() definition in example system.h
> to build init.cc by C++ compiler
>
> #ifdef __cplusplus
> extern "C" {
> #endif
>
> rtems_task Init(
>   rtems_task_argument argument
> );
>
> #ifdef __cplusplus
> } /* extern "C"*/
> #endif
>
> I expect that your problem cause can be that RTEMS OMK rules
> variant recognizes only *.cc extension as C++ sources correctly.
> It filters out other unknown sources extensions which leads
> to link of empty application without init table defaulting to main.
>
> I can try to enhance that that more used C++ extensions
> (*.C, *.cxx, *.cpp) are recognized by RTEMS OMK as well.
>
> You can check how OMK build calls build tools with use of V=1
> option, that is
>
>   make clean all V=1
>
> Best wishes,
>
>                 Pavel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160820/68ad94ef/attachment.html>


More information about the users mailing list