- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hello,
Can anyone point me to an example of actually building a Nios-II project with cpp? I have tried many ways and it always comes down to a build error. The problem seems to be related to the alt_main.c. There must be a simple method of creating a CPP program as the documentation states everywhere that CPP is supported. I cannot find a template or an example on the website. I see where the simple socket server has a cpp implementation but it is not a full example showing the linkage with a BSP. Thanks,Lien copié
4 Réponses
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
First of all you should rename as alt_main.cpp.
Then, if your .cpp contain functions which are supposed to be called from .c sources, you must declare them as extern "C"- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Thanks for the reply, but I have tried that before and run into bsp build errors with it not being able to find the alt_main.c file even thought I think (???) I changed the correct makefile to build a the cpp file.
Just one zipped up example of a complete project and bsp would be great if anyone has one. It just seems like it should be a no-brainer, but I just keep going around in circles. Thanks again.- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Try with others known extensions like .cc .C
I've heard of this problem- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
After much trial and error I have found a solution to building a simple CPP project.
- Build the BSP as usual (I make sure to check the enable small lib and small drivers).
- Build a NIOS-II project based on the BSP.
- With the project selected, add a new file to the project. I used the "File from Template". Make sure it has the .cpp extension. Now you should have the file insterted in your project, but it will have no code inside.
- Open the file for editing and insert the standard main() function, I used:

Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable