Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12606 Discussions

cant use functions, classes of managed library

Altera_Forum
Honored Contributor II
1,291 Views

Hi all, 

 

Currently I am working on Managed library. I have made a manage library in C++. This library includes some global functions, global variables and different classes. Now I have made one another C/C++ application. And in it use .cpp file extension. And I want to use the managed library functions and classes in the C/C++ application. But it gives me error of undeclared (first use this function)'. 

So if anybody knows please reply on it.
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
329 Views

 

--- Quote Start ---  

originally posted by slsnios@Jun 29 2006, 10:39 AM 

but it gives me error of undeclared (first use this function)'. 

so if anybody knows please reply on it. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16513) 

--- quote end ---  

 

--- Quote End ---  

 

 

probably you didn&#39;t include the .h/.hpp file of your class? 

 

Paolo
0 Kudos
Altera_Forum
Honored Contributor II
329 Views

 

--- Quote Start ---  

originally posted by paolo.gai+jun 29 2006, 03:18 pm--><div class='quotetop'>quote (paolo.gai @ jun 29 2006, 03:18 pm)</div> 

--- quote start ---  

<!--quotebegin-slsnios@Jun 29 2006, 10:39 AM 

but it gives me error of undeclared (first use this function)&#39;. 

so if anybody knows please reply on it. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16513) 

--- quote end ---  

 

--- Quote End ---  

 

 

probably you didn&#39;t include the .h/.hpp file of your class? 

 

Paolo 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16519)</div> 

[/b] 

--- Quote End ---  

 

 

This is my class in Managed Library. 

# include "iostream.h"  

 

class Form 

public:  

Form(); 

}; 

 

Form::Form() 

printf("Hello NIOS"); 

 

I want to use this managed library in my C/C++ application. 

# include<iostream.h> 

 

int main() 

Form *frm = new Form(); 

return 0; 

 

This is the code of application file even though it gives me error.
0 Kudos
Altera_Forum
Honored Contributor II
329 Views

A shot in the dark here.... 

 

If the "main" function is in a "C" file then you&#39;ll need to do a "C"-style function in the CPP file in order to to link it 

 

e.g. in CPP 

 

extern "C" void CreateForm (void) 

Form *frm = new Form(); 

 

 

then in main.c 

 

extern void CreateForm (void); 

 

int main () 

CreateForm () 

}
0 Kudos
Altera_Forum
Honored Contributor II
329 Views

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

This is my class in Managed Library. 

# include "iostream.h"  

 

class Form 

public:  

Form(); 

}; 

 

Form::Form() 

printf("Hello NIOS"); 

 

I want to use this managed library in my C/C++ application. 

# include<iostream.h> 

 

int main() 

Form *frm = new Form(); 

return 0; 

 

This is the code of application file even though it gives me error.[/b] 

--- Quote End ---  

 

 

It seems that you forget to include the header file of Form class. 

You can find the detail information about managed library project in NiosII IDE. 

Following the steps below: 

1. Open NiosII IDE 

2. Click Help->Help Content 

3. search keyword : "managed library" then you&#39;ll get what you want... 

 

Hope it will help.
0 Kudos
Altera_Forum
Honored Contributor II
329 Views

Dear all, 

 

Is it possible to bring only C++ application project and the library file *.a which is created by managed library project to customer without source code of managed library project? 

Is there any document to clarify this issue? 

 

Sorry for my disturbance, 

David
0 Kudos
Reply