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

Pavel Pisa ppisa4lists at pikron.com
Thu Aug 18 00:42:26 UTC 2016


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



More information about the users mailing list