-1

I cross compile an application for target device using ARM arch using Green Hills toolchain (the device will run INTEGRITY OS) but it fail with some error like that

__vec_new from ...
__vec_delete from ...

I don't understand what it means and how to resolve it. Anyone can help me ?

Andres Riofrio
  • 9,851
  • 7
  • 40
  • 60
TuanPM
  • 685
  • 8
  • 29
  • You appear to be compiling C++ code but not linking the C++ standard library, which provides implementations for the `new` and `delete` operators. – Clifford Nov 10 '16 at 09:33
  • I searched in my Arm compiler installed folder but not found the file libstdc++.a or something like that. Can you suggest me the file name of library it may contains implementation of new/delete? – TuanPM Nov 10 '16 at 11:19
  • You'd need then to add information about the toolchain to your question (i.e. gcc, armcc, IAR, Green Hills or other and version number), and you really should fix the question as I suggested (i.e. post the entire build log so we can see the compiler invocation and options used as well as the complete error messages, otherwise we are guessing). It is possible that your question is not a duplicate and can be reopened, but more information is required (edit the question - do not post comments with pertinent information - SO is not a discussion forum). – Clifford Nov 10 '16 at 11:40
  • I have already added more informaiton to my question. But I can not post entire build log because it is confidential of my company. Sorry for this inconvinience – TuanPM Nov 10 '16 at 15:09
  • You're probably running the compile (intentionally) with flags to disable dynamic memory allocation. This is fairly common in INTEGRITY. Especially if you're running the DO-178B flavor and/or not running the POSIX compatibility layers. Chances are, if allowed to run C++ at all, you're supposed to be writing in "EC++" or some similar flavor. – Brian McFarland Nov 10 '16 at 18:35
  • Also... if you're working as a subcontractor on a project that *requires* INTEGRITY, posting about it on SO is risky business.... – Brian McFarland Nov 10 '16 at 18:36
  • @Clifford - I'm not so sure this is an exact duplicate of the recommended post since the specific symbols referenced are for new/delete operations. Its quite possible that GHS provides a trimmed down `libstdc++` equivalent that disables these features, or that he shouldn't be linking against standard libraries at all. – Brian McFarland Nov 10 '16 at 18:39
  • 1
    @BrianMcFarland : I agree but without the additional information (Green Hills rather than GNU compiler), it was not possible to determine that. – Clifford Nov 10 '16 at 18:46
  • @tuanpm : You might still post the compiler, linker options you are using and an the complete error message. You are really not helping yourself. – Clifford Nov 10 '16 at 18:58

2 Answers2

2

Unresolved symbols indicate failure to link the necessary object code or libraries defining said symbols. These particular symbols are most probably related to implementations of the new and delete C++ operators, and most likely indicate that you have not linked the C++ library. I am not very familiar with the Green Hills tool chain, but, in cases where you invoke the linker separately to the compiler, you may need to explicitly specify C++ linking.

If using an IDE it is possible that you have created a C project but added C++ code - this may result in linker options that do not link C++ support and libraries.

The Green Hill's compiler has a choice of C++ libraries selected by either language variant option, or linker override option. These options can be set in the MULTI IDE settings or on the command line depending on how you are managing your project. Consult the compiler/linker documentation - I have found the following:

enter image description here

You should have access to the full documentation, the pages following this describe how teh linker searches libraries and how to specify alternate libraries. If you have disabled the automatic library search by specifying -nostdlib, the automatic linking will not be performed and you will have to explicitly link the necessary libraries.

Clifford
  • 88,407
  • 13
  • 85
  • 165
  • Note that this answer is a placeholder pending more explicit compiler/linker options from the OP. I will update it if the information is forthcoming. – Clifford Nov 10 '16 at 19:19
0

I have resolved the error

The cause is the project source contains a file *.c source it included and

I renamed it to *.cpp then the error disappeared

TuanPM
  • 685
  • 8
  • 29