I have generated an image for my VU+ Solo2 after following the instructions on the following URL: http://blog.videgro.net/2013/05/how-to-compile-software-for-vu-plus/.

This works OK if I use standard C-code (as in the example in the URL), but when I try to compile C++-code I get errors which seems to originate from using the gcc-compiler instead of the g++-compiler.

The variable CC tells which compiler to use, but I have no clue where and how I could change this.

My .bb-recipe is as follows:

DESCRIPTION = "dcp - Directory CoPy"
PR = "r0"

LICENSE = "TEST LICENSE"
LIC_FILES_CHKSUM = "file:///home/<username>/openvuplus/meta-openvuplus/recipes-extended/dcp/LICENSE;md5=d41d8cd98f00b204e9800998ecf8427e"

SRC_URI = "file://dcp.cpp \
       file://README.txt

do_compile() {
    ${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/dcp.cpp -o dcp
}

do_install() {
    install -m 0755 -d ${D}${bindir} ${D}${docdir}/dcp
    install -m 0755 ${S}/dcp ${D}${bindir}
    install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/dcp
}

My program uses multithreading (the pthread-library). Do I have to specify some special loader options for to tell the g++-compiler/loader to load that library ? And how do I do that ?

In this example I have put all the header-files and source-files together into one file (dcp.cpp). But how do I specify it if I want to use more than one source-file and one or two user-defined header files ? Could I just specify each file in the SRC_URI-section of the .bb-file ?

Sorry for my questions, but I'm a complete newbie on these matters. And I have searched through the net to try to find the solution, but all examples and docs seems to focus on a simple recipe with a simple C-routine. So I'm stuck..

Any help would be appreciated.

Typically, -pthread would be one of your LIBS, but you don't seem to have one of those. I'd be tempted to add LIBS = "-pthread" at the top, and ${LIBS} to the compile line.

CC is your compiler. Somewhere, presumably, that's being set to gcc.

You may have environment variables already set, that this takes advantage of. From the command line, run env and see what you get; CC and LIBS may be set already.

Addendum; CC is typically the C compiler. CXX is typically the CPP compiler.

Moschops: I changed the reference from {CC} to {CXX} in the .bb-file, and then the source code compiled as it should. Thanks for pointing me in the right direction.. :-)
(But I have not solved the problem about pthread not loading. That's the next step..)

See that ${CC}? You can probably replace that directly with g++.

The CXX reference works well, thank you.. :-)

Here are the correct compile commands for the .bb-file:

do_compile() {
${CXX} ${CXXFLAGS} ${LDFLAGS} ${WORKDIR}/dcp.cpp -lpthread -o dcp
}

And now I'm running my dcp-command on my VU+ Solo2... at last.!! :-)
Thanks to Moschops for all help and tips - it was very valueable for me..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.