Csound Csound-dev Csound-tekno Search About

[Cs-dev] API. Compilation with interface library

Date2012-09-24 17:00
Fromobaudouin
Subject[Cs-dev] API. Compilation with interface library
Dear Csounders,

I try to compile a single cpp file but I get an error ("CppSound.hpp not
found"; but the file exists). Could you help me please? I have probably
forgotten something...

COMMAND LINE (from Rory Walsh, Developing Audio Software with the Csound
Host API):

g++ cstestapi.cpp -o testapi
"/home/olivier/paquetages/Csound5.18.02/interfaces/csPerfThread.cpp"
-I"/home/olivier/paquetages/Csound5.18.02/H"
-L"/home/olivier/paquetages/Csound5.18.02" -lcsound64

ERROR MESSAGE:
cstestapi.cpp:1:24: erreur fatale: *CppSound.hpp : Aucun fichier ou dossier
de ce type*
compilation terminée.

FILE "cstestapi.cpp" (in path "/home/olivier/scripts")

#include "CppSound.hpp"
#include "csPerfThread.hpp"
#include 
#include 

using namespace std;

int main()
{
/* create string that holds an entire csd file */
std::string csdText = " \n\
 \n\
csound -odevaudio -b10 temp.orc temp.sco \n\
  \n\
  \n\
sr = 44100  \n\
kr = 44100  \n\
ksmps = 1  \n\
nchnls = 1  \n\
instr 1  \n\
k1 chnget \"freq\" \n\
a1 oscil 10000, k1+100, 1  \n\
out a1  \n\
endin   \n\
   \n\
  \n\
f1 0 1024 10 1  \n\
i1 0 100    \n\
 \n\
";

int hold;
/*create CppCsound class */
CppSound csound;
/* set the csd text */
csound.setCSD(csdText);
/* export csd text for performance */
csound.exportForPerformance(); 
/* compile csd text */
csound.compile();

/*create performance thread */
CsoundPerformanceThread thread(csound.getCsound());
cout << "Press 1 to play, 2 to pause and 0 to quit\n"; 
while(1){
cin >> hold;
if(hold==1){
	thread.Play();
	hold = 0;
	}
else if(hold==2){
	thread.Pause();
	hold=0;
	}
}
}





-----

Olivier Baudouin, PhD 
http://olivierbaudouin.com 
MINT-OMF 
Paris-Sorbonne

--
View this message in context: http://csound.1045644.n5.nabble.com/API-Compilation-with-interface-library-tp5716105.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.so

Date2012-09-24 17:42
FromRory Walsh
SubjectRe: [Cs-dev] API. Compilation with interface library
Try -I "/home/olivier/paquetages/Csound5.18.02/interfaces"

CppSound lives there if you are working from your own build of Csound.
If you are using one of the Linux installer then it should live in
/usr/local/include/Csound I think?

On 24 September 2012 17:00, obaudouin  wrote:
> Dear Csounders,
>
> I try to compile a single cpp file but I get an error ("CppSound.hpp not
> found"; but the file exists). Could you help me please? I have probably
> forgotten something...
>
> COMMAND LINE (from Rory Walsh, Developing Audio Software with the Csound
> Host API):
>
> g++ cstestapi.cpp -o testapi
> "/home/olivier/paquetages/Csound5.18.02/interfaces/csPerfThread.cpp"
> -I"/home/olivier/paquetages/Csound5.18.02/H"
> -L"/home/olivier/paquetages/Csound5.18.02" -lcsound64
>
> ERROR MESSAGE:
> cstestapi.cpp:1:24: erreur fatale: *CppSound.hpp : Aucun fichier ou dossier
> de ce type*
> compilation terminée.
>
> FILE "cstestapi.cpp" (in path "/home/olivier/scripts")
>
> #include "CppSound.hpp"
> #include "csPerfThread.hpp"
> #include 
> #include 
>
> using namespace std;
>
> int main()
> {
> /* create string that holds an entire csd file */
> std::string csdText = " \n\
>  \n\
> csound -odevaudio -b10 temp.orc temp.sco \n\
>   \n\
>   \n\
> sr = 44100  \n\
> kr = 44100  \n\
> ksmps = 1  \n\
> nchnls = 1  \n\
> instr 1  \n\
> k1 chnget \"freq\" \n\
> a1 oscil 10000, k1+100, 1  \n\
> out a1  \n\
> endin   \n\
>    \n\
>   \n\
> f1 0 1024 10 1  \n\
> i1 0 100    \n\
>  \n\
> ";
>
> int hold;
> /*create CppCsound class */
> CppSound csound;
> /* set the csd text */
> csound.setCSD(csdText);
> /* export csd text for performance */
> csound.exportForPerformance();
> /* compile csd text */
> csound.compile();
>
> /*create performance thread */
> CsoundPerformanceThread thread(csound.getCsound());
> cout << "Press 1 to play, 2 to pause and 0 to quit\n";
> while(1){
> cin >> hold;
> if(hold==1){
>         thread.Play();
>         hold = 0;
>         }
> else if(hold==2){
>         thread.Pause();
>         hold=0;
>         }
> }
> }
>
>
>
>
>
> -----
>
> Olivier Baudouin, PhD
> http://olivierbaudouin.com
> MINT-OMF
> Paris-Sorbonne
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/API-Compilation-with-interface-library-tp5716105.html
> Sent from the Csound - Dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-09-24 19:31
Fromobaudouin
SubjectRe: [Cs-dev] API. Compilation with interface library
Thank you Rory. I tried:

    g++ cstestapi.cpp -o %1 -I"/home/olivier/paquetages/Csound5.18.02/H"
-I"/home/olivier/paquetages/Csound5.18.02/interfaces"
-L"/home/olivier/paquetages/Csound5.18.02/" -lcsound64

Now, I get another error:

    /tmp/cccpQQGP.o: In function `main':
    cstestapi.cpp:(.text+0x71): undefined reference to
`CsoundFile::setCSD(std::string)'
    cstestapi.cpp:(.text+0x90): undefined reference to
`CsoundFile::exportForPerformance() const'
    cstestapi.cpp:(.text+0x9f): undefined reference to `CppSound::compile()'
    cstestapi.cpp:(.text+0xae): undefined reference to
`CppSound::getCsound()'
    cstestapi.cpp:(.text+0xc3): undefined reference to
`CsoundPerformanceThread::CsoundPerformanceThread(CSOUND_*)'
    (...)



-----

Olivier Baudouin, PhD 
http://olivierbaudouin.com 
MINT-OMF 
Paris-Sorbonne

--
View this message in context: http://csound.1045644.n5.nabble.com/API-Compilation-with-interface-library-tp5716105p5716115.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-09-25 01:45
FromRory Walsh
SubjectRe: [Cs-dev] API. Compilation with interface library
AttachmentsNone  None  
In my understanding of things it looks like whatever library you are linking against does not contain the jazz you're looking for. In the world of Rory it would appear that you need to link to csnd.so or something like that. The "CsoundFile" functions you are trying to access are not part of the csound64 library.

Date2012-09-25 08:17
Fromobaudouin
SubjectRe: [Cs-dev] API. Compilation with interface library
OK. That is better with the command line below. But I get a library error
that I do not succeed to do.

COMMAND LINE:

g++ cstestapi.cpp -o testapi -I"/home/olivier/paquetages/Csound5.18.02/H"
-I"/home/olivier/paquetages/Csound5.18.02/interfaces"
-L"/home/olivier/paquetages/Csound5.18.02/" -lcsound64 -lcsnd

ERROR MESSAGE:

/usr/bin/ld: /home/olivier/paquetages/Csound5.18.02//libcsound64.a(fout.o):
undefined reference to symbol 'sf_readf_double@@libsndfile.so.1.0'
/usr/bin/ld: note: 'sf_readf_double@@libsndfile.so.1.0' is defined in DSO
/lib64/libsndfile.so.1 so try adding it to the linker command line
/lib64/libsndfile.so.1: could not read symbols: Invalid operation
collect2: erreur: ld a retourné 1 code d'état d'exécution

AT CSOUND COMPILATION:

Checking for C library sndfile... yes
Checking for libsndfile version 1.0.19 or later... yes




-----

Olivier Baudouin, PhD 
http://olivierbaudouin.com 
MINT-OMF 
Paris-Sorbonne

--
View this message in context: http://csound.1045644.n5.nabble.com/API-Compilation-with-interface-library-tp5716105p5716131.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://li

Date2012-09-25 10:17
FromRory Walsh
SubjectRe: [Cs-dev] API. Compilation with interface library
My usual linker options on Linux are

-lcsound64 -lm -lsndfile

The -lsndfile should sort the most recent problem you are having.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-09-25 10:18
FromVictor Lazzarini
SubjectRe: [Cs-dev] API. Compilation with interface library
On 25 Sep 2012, at 08:17, obaudouin wrote:

> OK. That is better with the command line below. But I get a library error
> that I do not succeed to do.
> 
> COMMAND LINE:
> 
> g++ cstestapi.cpp -o testapi -I"/home/olivier/paquetages/Csound5.18.02/H"
> -I"/home/olivier/paquetages/Csound5.18.02/interfaces"
> -L"/home/olivier/paquetages/Csound5.18.02/" -lcsound64 -lcsnd
> 
> ERROR MESSAGE:
> 
> /usr/bin/ld: /home/olivier/paquetages/Csound5.18.02//libcsound64.a(fout.o):
> undefined reference to symbol 'sf_readf_double@@libsndfile.so.1.0'
> /usr/bin/ld: note: 'sf_readf_double@@libsndfile.so.1.0' is defined in DSO
> /lib64/libsndfile.so.1 so try adding it to the linker command line
> /lib64/libsndfile.so.1: could not read symbols: Invalid operation
> collect2: erreur: ld a retourné 1 code d'état d'exécution
> 

-lsndfile is needed.

> AT CSOUND COMPILATION:
> 
> Checking for C library sndfile... yes
> Checking for libsndfile version 1.0.19 or later... yes
> 
> 
> 
> 
> -----
> 
> Olivier Baudouin, PhD 
> http://olivierbaudouin.com 
> MINT-OMF 
> Paris-Sorbonne
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/API-Compilation-with-interface-library-tp5716105p5716131.html
> Sent from the Csound - Dev mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-09-25 10:51
Fromobaudouin
SubjectRe: [Cs-dev] API. Compilation with interface library
Compilation is OK with:

g++ cstestapi.cpp -o testapi -I"/home/olivier/paquetages/Csound5.18.02/H"
-I"/home/olivier/paquetages/Csound5.18.02/interfaces"
-L"/home/olivier/paquetages/Csound5.18.02/" -lcsound64 -lcsnd -lsndfile
-lpthread -lgomp -ldl

I don't know why I have to add "-lsndfile -lpthread -lgomp -ldl"... but it
works!

NOW: ERROR AT EXECUTION, libcsnd not found...

./testapi: error while loading shared libraries: libcsnd.so.5.2: cannot open
shared object file: No such file or directory




-----

Olivier Baudouin, PhD 
http://olivierbaudouin.com 
MINT-OMF 
Paris-Sorbonne

--
View this message in context: http://csound.1045644.n5.nabble.com/API-Compilation-with-interface-library-tp5716105p5716135.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-09-25 10:58
FromRory Walsh
SubjectRe: [Cs-dev] API. Compilation with interface library
When you built Csound did you add the buildInterfaces=1 option?

On 25 September 2012 10:51, obaudouin  wrote:
> Compilation is OK with:
>
> g++ cstestapi.cpp -o testapi -I"/home/olivier/paquetages/Csound5.18.02/H"
> -I"/home/olivier/paquetages/Csound5.18.02/interfaces"
> -L"/home/olivier/paquetages/Csound5.18.02/" -lcsound64 -lcsnd -lsndfile
> -lpthread -lgomp -ldl
>
> I don't know why I have to add "-lsndfile -lpthread -lgomp -ldl"... but it
> works!
>
> NOW: ERROR AT EXECUTION, libcsnd not found...
>
> ./testapi: error while loading shared libraries: libcsnd.so.5.2: cannot open
> shared object file: No such file or directory
>
>
>
>
> -----
>
> Olivier Baudouin, PhD
> http://olivierbaudouin.com
> MINT-OMF
> Paris-Sorbonne
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/API-Compilation-with-interface-library-tp5716105p5716135.html
> Sent from the Csound - Dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-09-25 11:00
Fromobaudouin
SubjectRe: [Cs-dev] API. Compilation with interface library
Yes, of course:

scons useDouble=1 usePortMIDI=0  buildRelease=1 Word64=1 Lib64=1
useCoreAudio=0  useOpenMP=1 buildInterfaces=1 includeSerial=1 noDebug=1




-----

Olivier Baudouin, PhD 
http://olivierbaudouin.com 
MINT-OMF 
Paris-Sorbonne

--
View this message in context: http://csound.1045644.n5.nabble.com/API-Compilation-with-interface-library-tp5716105p5716137.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-09-25 12:53
FromVictor Lazzarini
SubjectRe: [Cs-dev] API. Compilation with interface library
The library is there, since you've built your program. It's just no in the search path for .so. Try installing it in /usr/local/lib and running ldconfig afterwards.

Victor
On 25 Sep 2012, at 10:51, obaudouin wrote:

> Compilation is OK with:
> 
> g++ cstestapi.cpp -o testapi -I"/home/olivier/paquetages/Csound5.18.02/H"
> -I"/home/olivier/paquetages/Csound5.18.02/interfaces"
> -L"/home/olivier/paquetages/Csound5.18.02/" -lcsound64 -lcsnd -lsndfile
> -lpthread -lgomp -ldl
> 
> I don't know why I have to add "-lsndfile -lpthread -lgomp -ldl"... but it
> works!
> 
> NOW: ERROR AT EXECUTION, libcsnd not found...
> 
> ./testapi: error while loading shared libraries: libcsnd.so.5.2: cannot open
> shared object file: No such file or directory
> 
> 
> 
> 
> -----
> 
> Olivier Baudouin, PhD 
> http://olivierbaudouin.com 
> MINT-OMF 
> Paris-Sorbonne
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/API-Compilation-with-interface-library-tp5716105p5716135.html
> Sent from the Csound - Dev mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-09-25 13:07
Fromobaudouin
SubjectRe: [Cs-dev] API. Compilation with interface library
That works when I put a symbolic link to libcsnd.so.5.2 into the /usr/lib64
folder.

Merci beaucoup !

Olivier.



-----

Olivier Baudouin, PhD 
http://olivierbaudouin.com 
MINT-OMF 
Paris-Sorbonne

--
View this message in context: http://csound.1045644.n5.nabble.com/API-Compilation-with-interface-library-tp5716105p5716141.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net