0

I am use TI 8.3.11 (Code Composer Studio) Device Family C6000, SYS/Bios 6.67.3.01

I have a problem with variadic function, which accepts a variable number of arguments. My class:

#include "stdint.h"
#include "stdarg.h"
#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Memory.h>
#include <ti/sysbios/heaps/HeapBuf.h>
#include "nexus.hpp"
class Neuron
{
public:
    explicit Neuron() = default;
    ~Neuron();
public:
    void AllocManyNexuses(int count, ...) noexcept;
}

And in cpp i determined it:

void Neuron::AllocManyNexuses(int count, ...) noexcept
{
    const xdc_runtime_IHeap_Handle nexusHandle=reinterpret_cast<xdc_runtime_IHeap_Handle>(heap4KbpNetNexus);
    Error_Block eb;
    Error_init(&eb);
    nexus =reinterpret_cast<Nexus*>(Memory_calloc(nexusHandle, sizeof(Nexus), 0, &eb));


    va_list doubleLists;
    va_start(doubleLists, count);    
    for(int i=0;i<count; ++i)
    {
    and etc
}

My compiler get me some dummy errors:

"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/std.h", line 41: error #20: identifier "va_list" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 118: error #20: identifier "int_least8_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 119: error #20: identifier "uint_least8_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 120: error #20: identifier "int_least16_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 121: error #20: identifier "uint_least16_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 122: error #20: identifier "int_least32_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 123: error #20: identifier "uint_least32_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 126: error #20: identifier "int_least64_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 127: error #20: identifier "uint_least64_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 131: error #20: identifier "int_least40_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 132: error #20: identifier "uint_least40_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 147: error #20: identifier "uint8_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 150: error #20: identifier "uint16_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 153: error #20: identifier "uint32_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 156: error #20: identifier "uint64_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 162: error #20: identifier "intptr_t" is undefined
"C:/ti/bios_6_76_03_01/packages/ti/targets/std.h", line 163: error #20: identifier "uintptr_t" is undefined
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/std.h", line 196: warning #552-D: variable "u" was set but never used
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/runtime/System.h", line 387: error #20: identifier "va_list" is undefined
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/runtime/System.h", line 389: error #20: identifier "va_list" is undefined
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/runtime/System.h", line 396: error #20: identifier "va_list" is undefined
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/runtime/System.h", line 398: error #20: identifier "va_list" is undefined
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/runtime/System.h", line 405: error #20: identifier "va_list" is undefined
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/runtime/System.h", line 407: error #20: identifier "va_list" is undefined
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/runtime/System.h", line 414: error #20: identifier "va_list" is undefined
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/runtime/System.h", line 416: error #20: identifier "va_list" is undefined
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/runtime/System.h", line 443: error #20: identifier "va_list" is undefined
"C:/ti/ccs1220/xdctools_3_62_01_16_core/packages/xdc/runtime/System.h", line 445: error #20: identifier "va_list" is undefined
27 errors detected in the compilation of "../lib/containers/kbpVector.cpp".
gmake: *** [lib/containers/kbpVector.obj] Error 1

What I do wrong, guys?

Jarod42
  • 203,559
  • 14
  • 181
  • 302
  • 1
    Well it certainly should be `#include ` and `#include ` but I'd be surprised if that explains this error. – john Jul 13 '23 at 12:42
  • I try to goolge and get some solutions like these, but do not help me –  Jul 13 '23 at 12:44
  • 2
    it should be `#include ` and `#include `, but afaik it doesnt actually matter – 463035818_is_not_an_ai Jul 13 '23 at 12:47
  • 2
    It seems to me that the problem is with the header files you are including. So I would remove all your code, and just include header files. See if you can work out which one is causing the problems. Of course header files should be written so that you can include whatever you need in whatever order, but it seems like that's not true of the header files you are using, – john Jul 13 '23 at 12:47
  • Error while including only, maybe these function is unavailable or have unclear way to include –  Jul 13 '23 at 12:53
  • 1
    What I've heard is that Texas Instruments isn't the best at implementing the standard i.e. not standard complete. Maybe these are some things that they don't support? – Mestkon Jul 13 '23 at 12:56
  • @Mestkon i know that templates and inline functions some time have some trobles. But i have no another device –  Jul 13 '23 at 13:00
  • 2
    Can you use [variadic template](https://en.cppreference.com/w/cpp/language/parameter_pack) instead? – Jarod42 Jul 13 '23 at 13:11
  • 1
    Avoid `va_list` in modern C++ if at all possible. Prefer type-safe variadic templates instead. – Jesper Juhl Jul 13 '23 at 13:13
  • @Jarod42 will try and answer –  Jul 13 '23 at 13:15
  • 1
    I remember using `va_list` and `...` back in prehistoric times, when I was writing C, back when dinosaurs roamed the Earth. In current times, in C++, I use templates. – Sam Varshavchik Jul 13 '23 at 13:15

1 Answers1

0
#include <iostream>

template<class ...DOU>
static void product(DOU ...doubles) {
    constexpr int numOfArgs=sizeof...(doubles);
    double arr[numOfArgs]={};
    int index = 0;
    auto setValLamda=[&arr, &index](double i){
        arr[index]= i;
        ++index;
        return i;
    };
    auto supapro = { (setValLamda(doubles),...)};
    for (double val:arr)
    {
        std::cout << val << '\n';
    }
}



int main() {
    product<double>(2.2, 6.2);
    return 0;
}