Csound Csound-dev Csound-tekno Search About

[Csnd-dev] Invalid Char** to Const Char** - Csound64 6.11, MingW, Code Blocks

Date2018-06-23 14:49
FromEphesian <000003af25e6c9be-dmarc-request@LISTSERV.HEANET.IE>
Subject[Csnd-dev] Invalid Char** to Const Char** - Csound64 6.11, MingW, Code Blocks
Greetings,

Recently I've taken an interest in learning C++ coding with CSound6.11 (x64). I've started following the CSound Floss Manual at http://write.flossmanuals.net/csound/preface/ ... ... particularly the section THE CSOUND API in chapter 12. I'm using MinGW along with Code::Blocks to do my compiling. I've included the CSOUND.HPP C++ wrapper in the project's search directory list.I've also added the path to the link library csound64.lib

Please note, i'm relativly new to C++ programming so be patient with me if I've overlooked something completely obvious to any one reading this. Also if I'm posting in the wrong forum please direct me to the correct one.

The first example in the API section is written in C but then is followed up by the C++ equivalent:

1  #include 
2
3  int main(int argc, char **argv)
4  {
5    Csound *cs = new Csound();
6    int result = cs->Compile(argc, argv);
7    if (result == 0){
8      result = cs->Perform();
9    }
10   return (result >= 0 ? 0 : result);
11 }

But when I goto compile it I'm getting the following error in the Build Messages:

Line 9: error: invalid conversion from 'char**' to 'const char**' [-fpermissive]

I'm not sure where to go from here. I think I understand the error, but either:
1) there is something wrong with the Floss Manual
2) there is something wrong with csound.hpp wrapper OR
3) I'm missing something in the project settings

Date2018-06-23 15:16
FromVictor Lazzarini
SubjectRe: [Csnd-dev] Invalid Char** to Const Char** - Csound64 6.11, MingW, Code Blocks
main() should be defined with const char**
instead.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 23 Jun 2018, at 15:00, Ephesian <000003af25e6c9be-dmarc-request@LISTSERV.HEANET.IE> wrote:
> 
> Greetings,
> 
> Recently I've taken an interest in learning C++ coding with CSound6.11 (x64). I've started following the CSound Floss Manual at http://write.flossmanuals.net/csound/preface/ ... ... particularly the section THE CSOUND API in chapter 12. I'm using MinGW along with Code::Blocks to do my compiling. I've included the CSOUND.HPP C++ wrapper in the project's search directory list.I've also added the path to the link library csound64.lib
> 
> Please note, i'm relativly new to C++ programming so be patient with me if I've overlooked something completely obvious to any one reading this. Also if I'm posting in the wrong forum please direct me to the correct one.
> 
> The first example in the API section is written in C but then is followed up by the C++ equivalent:
> 
> 1  #include 
> 2
> 3  int main(int argc, char **argv)
> 4  {
> 5    Csound *cs = new Csound();
> 6    int result = cs->Compile(argc, argv);
> 7    if (result == 0){
> 8      result = cs->Perform();
> 9    }
> 10   return (result >= 0 ? 0 : result);
> 11 }
> 
> But when I goto compile it I'm getting the following error in the Build Messages:
> 
> Line 9: error: invalid conversion from 'char**' to 'const char**' [-fpermissive]
> 
> I'm not sure where to go from here. I think I understand the error, but either:
> 1) there is something wrong with the Floss Manual
> 2) there is something wrong with csound.hpp wrapper OR
> 3) I'm missing something in the project settings
> 

Date2018-06-23 15:55
Fromjpff
SubjectRe: [Csnd-dev] Invalid Char** to Const Char** - Csound64 6.11, MingW, Code Blocks
To do withvetsions of C++ i think.  try adding const before char** on line 
3

It is valid C but C++ has other ideas,
==John ff

On Sat, 23 Jun 2018, Ephesian wrote:

> Greetings,
>
> Recently I've taken an interest in learning C++ coding with CSound6.11 (x64). I've started following the CSound Floss Manual at http://write.flossmanuals.net/csound/preface/ ... ... particularly the section THE CSOUND API in chapter 12. I'm using MinGW along with Code::Blocks to do my compiling. I've included the CSOUND.HPP C++ wrapper in the project's search directory list.I've also added the path to the link library csound64.lib
>
> Please note, i'm relativly new to C++ programming so be patient with me if I've overlooked something completely obvious to any one reading this. Also if I'm posting in the wrong forum please direct me to the correct one.
>
> The first example in the API section is written in C but then is followed up by the C++ equivalent:
>
> 1  #include 
> 2
> 3  int main(int argc, char **argv)
> 4  {
> 5    Csound *cs = new Csound();
> 6    int result = cs->Compile(argc, argv);
> 7    if (result == 0){
> 8      result = cs->Perform();
> 9    }
> 10   return (result >= 0 ? 0 : result);
> 11 }
>
> But when I goto compile it I'm getting the following error in the Build Messages:
>
> Line 9: error: invalid conversion from 'char**' to 'const char**' [-fpermissive]
>
> I'm not sure where to go from here. I think I understand the error, but either:
> 1) there is something wrong with the Floss Manual
> 2) there is something wrong with csound.hpp wrapper OR
> 3) I'm missing something in the project settings
>
> Can anyone out there help me with this? I would greatly appreaciate it.

Date2018-06-25 20:02
FromEphesian <000003af25e6c9be-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd-dev] Invalid Char** to Const Char** - Csound64 6.11, MingW, Code Blocks
Thank You jpff and Victor Lazzarini for your replies.
So I've changed the code to:

int main(int argc, *const* char **argv)

Now when building I get:
obj\Release\csoundtest.o:csoundtest.cpp:(.text$_ZN6Csound7CompileEPKcS1_S1_S1_S1_[__ZN6Csound7CompileEPKcS1_S1_S1_S1_]+0x52)||undefined
reference to `csoundCompile'|

I'm thinking it's because I don't know enough about how CSound and C++ work
together. I need a good modern tutorial with simple examples that build from
the ground up, explaining everything step by step.

One thing to note, is all I did was copy and paste the code from the
tutorial. I'm wondering if this new error is occurring because I don't yet
have and Orchestra and a Score defined yet.

Thank you all.



--

Date2018-06-25 21:14
FromVictor Lazzarini
SubjectRe: [Csnd-dev] Invalid Char** to Const Char** - Csound64 6.11, MingW, Code Blocks
That’s just an undefined reference because you are not probably passing the Csound library at link time.
The program depends on that.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 25 Jun 2018, at 20:02, Ephesian <000003af25e6c9be-dmarc-request@LISTSERV.HEANET.IE> wrote:
> 
> Thank You jpff and Victor Lazzarini for your replies.
> So I've changed the code to:
> 
> int main(int argc, *const* char **argv)
> 
> Now when building I get:
> obj\Release\csoundtest.o:csoundtest.cpp:(.text$_ZN6Csound7CompileEPKcS1_S1_S1_S1_[__ZN6Csound7CompileEPKcS1_S1_S1_S1_]+0x52)||undefined
> reference to `csoundCompile'|
> 
> I'm thinking it's because I don't know enough about how CSound and C++ work
> together. I need a good modern tutorial with simple examples that build from
> the ground up, explaining everything step by step.
> 
> One thing to note, is all I did was copy and paste the code from the
> tutorial. I'm wondering if this new error is occurring because I don't yet
> have and Orchestra and a Score defined yet.
> 
> Thank you all.
> 
> 
> 
> --
> Sent from: http://

Date2018-06-25 21:21
FromGuillermo Senna
SubjectRe: [Csnd-dev] Invalid Char** to Const Char** - Csound64 6.11, MingW, Code Blocks
Hi,

This is a good list of recommended books for learning C++:
https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list

Cheers.


On 25/06/18 16:02, Ephesian wrote:
> Thank You jpff and Victor Lazzarini for your replies.
> So I've changed the code to:
>
> int main(int argc, *const* char **argv)
>
> Now when building I get:
> obj\Release\csoundtest.o:csoundtest.cpp:(.text$_ZN6Csound7CompileEPKcS1_S1_S1_S1_[__ZN6Csound7CompileEPKcS1_S1_S1_S1_]+0x52)||undefined
> reference to `csoundCompile'|
>
> I'm thinking it's because I don't know enough about how CSound and C++ work
> together. I need a good modern tutorial with simple examples that build from
> the ground up, explaining everything step by step.
>
> One thing to note, is all I did was copy and paste the code from the
> tutorial. I'm wondering if this new error is occurring because I don't yet
> have and Orchestra and a Score defined yet.
>
> Thank you all.
>
>
>
> --