Csound Csound-dev Csound-tekno Search About

[Csnd] VS header file issue

Date2021-08-16 00:47
FromJana Cole
Subject[Csnd] VS header file issue
Hi Everyone,

I'm having a strange header file issue I don't know what to make of. Maybe you've seen it before.
Apparently VS can see csound.hpp but not csPerfThread.hpp. They're in the same directory!

I've posted the errors and source code below. VS has no problem finding the Csound class, only methods in the CsoundPerformanceThread class.
What could be the problem?

Rebuild started...
1>------ Rebuild All started: Project: csound_api_test, Configuration: Debug x64 ------
1>csound_api_test.cpp
1>C:\Program Files\Csound6_x64\include\csound\csound.hpp(437,39): warning C4244: 'return': conversion from 'int64_t' to 'long', possible loss of data
1>   Creating library C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.lib and object C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.exp
1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: void __cdecl CsoundPerformanceThread::Play(void)" (?Play@CsoundPerformanceThread@@QEAAXXZ) referenced in function main
1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: void __cdecl CsoundPerformanceThread::Stop(void)" (?Stop@CsoundPerformanceThread@@QEAAXXZ) referenced in function main
1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: int __cdecl CsoundPerformanceThread::Join(void)" (?Join@CsoundPerformanceThread@@QEAAHXZ) referenced in function main
1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: __cdecl CsoundPerformanceThread::CsoundPerformanceThread(struct CSOUND_ *)" (??0CsoundPerformanceThread@@QEAA@PEAUCSOUND_@@@Z) referenced in function main
1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: __cdecl CsoundPerformanceThread::~CsoundPerformanceThread(void)" (??1CsoundPerformanceThread@@QEAA@XZ) referenced in function main
1>C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.exe : fatal error LNK1120: 5 unresolved externals
1>Done building project "csound_api_test.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

#include 
#include "csound.hpp"
#include "csPerfThread.hpp"

int main(int argc, const char* argv[])
{
	int result = 0;
	Csound cs;
	result = cs.Compile(argc, argv);

	if (!result)
	{
		CsoundPerformanceThread perfThread(cs.GetCsound());
		perfThread.Play(); // Starts performance
		while (perfThread.GetStatus() == 0);
		// nothing to do here...
		// but you could process input events, graphics etc
		perfThread.Stop();  // Stops performance. In fact, performance should have
							// already finished, so this is just an example of how
							//to stop if you need
		perfThread.Join();  // always call Join() after Stop() as a rule of thumb.
	}
	else {
		printf("csoundCompile returned an error\n");
		return 1;
	}

	return 0;
}

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2021-08-16 08:22
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] VS header file issue
That's not a header issue, these are link errors, you need to add csnd.lib (the link lib for csnd.dll) to your project. That contains the symbols missing.

Prof. Victor Lazzarini
Maynooth University
Ireland

> On Aug 16, 2021, at 12:47 AM, Jana Cole  wrote:
> 
> *Warning*
> 
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> 
> Hi Everyone,
> 
> I'm having a strange header file issue I don't know what to make of. Maybe you've seen it before.
> Apparently VS can see csound.hpp but not csPerfThread.hpp. They're in the same directory!
> 
> I've posted the errors and source code below. VS has no problem finding the Csound class, only methods in the CsoundPerformanceThread class.
> What could be the problem?
> 
> Rebuild started...
> 1>------ Rebuild All started: Project: csound_api_test, Configuration: Debug x64 ------
> 1>csound_api_test.cpp
> 1>C:\Program Files\Csound6_x64\include\csound\csound.hpp(437,39): warning C4244: 'return': conversion from 'int64_t' to 'long', possible loss of data
> 1>   Creating library C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.lib and object C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.exp
> 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: void __cdecl CsoundPerformanceThread::Play(void)" (?Play@CsoundPerformanceThread@@QEAAXXZ) referenced in function main
> 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: void __cdecl CsoundPerformanceThread::Stop(void)" (?Stop@CsoundPerformanceThread@@QEAAXXZ) referenced in function main
> 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: int __cdecl CsoundPerformanceThread::Join(void)" (?Join@CsoundPerformanceThread@@QEAAHXZ) referenced in function main
> 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: __cdecl CsoundPerformanceThread::CsoundPerformanceThread(struct CSOUND_ *)" (??0CsoundPerformanceThread@@QEAA@PEAUCSOUND_@@@Z) referenced in function main
> 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: __cdecl CsoundPerformanceThread::~CsoundPerformanceThread(void)" (??1CsoundPerformanceThread@@QEAA@XZ) referenced in function main
> 1>C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.exe : fatal error LNK1120: 5 unresolved externals
> 1>Done building project "csound_api_test.vcxproj" -- FAILED.
> ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
> 
> #include 
> #include "csound.hpp"
> #include "csPerfThread.hpp"
> 
> int main(int argc, const char* argv[])
> {
>        int result = 0;
>        Csound cs;
>        result = cs.Compile(argc, argv);
> 
>        if (!result)
>        {
>                CsoundPerformanceThread perfThread(cs.GetCsound());
>                perfThread.Play(); // Starts performance
>                while (perfThread.GetStatus() == 0);
>                // nothing to do here...
>                // but you could process input events, graphics etc
>                perfThread.Stop();  // Stops performance. In fact, performance should have
>                                                        // already finished, so this is just an example of how
>                                                        //to stop if you need
>                perfThread.Join();  // always call Join() after Stop() as a rule of thumb.
>        }
>        else {
>                printf("csoundCompile returned an error\n");
>                return 1;
>        }
> 
>        return 0;
> }
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C42b805a64b5a4364f65708d9604714c1%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637646680680422340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pPV0NuVXsZANA3dVc%2Fl4JyXj5VudGtWdOiZoiaC9AOc%3D&reserved=0
> Send bugs reports to
>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C42b805a64b5a4364f65708d9604714c1%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637646680680422340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Q4JjByMpBjk67DXBVfo%2FevvKwYp8TXjVastvi6cTZiA%3D&reserved=0
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2021-08-16 08:50
FromRory Walsh
SubjectRe: [Csnd] [EXTERNAL] [Csnd] VS header file issue
Or simply add the perf thread .cpp file to your project. 

On Mon 16 Aug 2021, 8:22 a.m. Victor Lazzarini, <Victor.Lazzarini@mu.ie> wrote:
That's not a header issue, these are link errors, you need to add csnd.lib (the link lib for csnd.dll) to your project. That contains the symbols missing.

Prof. Victor Lazzarini
Maynooth University
Ireland

> On Aug 16, 2021, at 12:47 AM, Jana Cole <quikscor@ix.netcom.com> wrote:
>
> *Warning*
>
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>
> Hi Everyone,
>
> I'm having a strange header file issue I don't know what to make of. Maybe you've seen it before.
> Apparently VS can see csound.hpp but not csPerfThread.hpp. They're in the same directory!
>
> I've posted the errors and source code below. VS has no problem finding the Csound class, only methods in the CsoundPerformanceThread class.
> What could be the problem?
>
> Rebuild started...
> 1>------ Rebuild All started: Project: csound_api_test, Configuration: Debug x64 ------
> 1>csound_api_test.cpp
> 1>C:\Program Files\Csound6_x64\include\csound\csound.hpp(437,39): warning C4244: 'return': conversion from 'int64_t' to 'long', possible loss of data
> 1>   Creating library C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.lib and object C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.exp
> 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: void __cdecl CsoundPerformanceThread::Play(void)" (?Play@CsoundPerformanceThread@@QEAAXXZ) referenced in function main
> 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: void __cdecl CsoundPerformanceThread::Stop(void)" (?Stop@CsoundPerformanceThread@@QEAAXXZ) referenced in function main
> 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: int __cdecl CsoundPerformanceThread::Join(void)" (?Join@CsoundPerformanceThread@@QEAAHXZ) referenced in function main
> 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: __cdecl CsoundPerformanceThread::CsoundPerformanceThread(struct CSOUND_ *)" (??0CsoundPerformanceThread@@QEAA@PEAUCSOUND_@@@Z) referenced in function main
> 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: __cdecl CsoundPerformanceThread::~CsoundPerformanceThread(void)" (??1CsoundPerformanceThread@@QEAA@XZ) referenced in function main
> 1>C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.exe : fatal error LNK1120: 5 unresolved externals
> 1>Done building project "csound_api_test.vcxproj" -- FAILED.
> ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
>
> #include <stdio.h>
> #include "csound.hpp"
> #include "csPerfThread.hpp"
>
> int main(int argc, const char* argv[])
> {
>        int result = 0;
>        Csound cs;
>        result = cs.Compile(argc, argv);
>
>        if (!result)
>        {
>                CsoundPerformanceThread perfThread(cs.GetCsound());
>                perfThread.Play(); // Starts performance
>                while (perfThread.GetStatus() == 0);
>                // nothing to do here...
>                // but you could process input events, graphics etc
>                perfThread.Stop();  // Stops performance. In fact, performance should have
>                                                        // already finished, so this is just an example of how
>                                                        //to stop if you need
>                perfThread.Join();  // always call Join() after Stop() as a rule of thumb.
>        }
>        else {
>                printf("csoundCompile returned an error\n");
>                return 1;
>        }
>
>        return 0;
> }
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&amp;data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C42b805a64b5a4364f65708d9604714c1%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637646680680422340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=pPV0NuVXsZANA3dVc%2Fl4JyXj5VudGtWdOiZoiaC9AOc%3D&amp;reserved=0
> Send bugs reports to
>        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&amp;data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C42b805a64b5a4364f65708d9604714c1%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637646680680422340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Q4JjByMpBjk67DXBVfo%2FevvKwYp8TXjVastvi6cTZiA%3D&amp;reserved=0
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2021-08-16 09:59
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] VS header file issue
For that you need the sources, but yes that should work.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 16 Aug 2021, at 08:50, Rory Walsh  wrote:
> 
> Or simply add the perf thread .cpp file to your project. 
> 
> On Mon 16 Aug 2021, 8:22 a.m. Victor Lazzarini,  wrote:
> That's not a header issue, these are link errors, you need to add csnd.lib (the link lib for csnd.dll) to your project. That contains the symbols missing.
> 
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
> 
> > On Aug 16, 2021, at 12:47 AM, Jana Cole  wrote:
> > 
> > *Warning*
> > 
> > This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> > 
> > Hi Everyone,
> > 
> > I'm having a strange header file issue I don't know what to make of. Maybe you've seen it before.
> > Apparently VS can see csound.hpp but not csPerfThread.hpp. They're in the same directory!
> > 
> > I've posted the errors and source code below. VS has no problem finding the Csound class, only methods in the CsoundPerformanceThread class.
> > What could be the problem?
> > 
> > Rebuild started...
> > 1>------ Rebuild All started: Project: csound_api_test, Configuration: Debug x64 ------
> > 1>csound_api_test.cpp
> > 1>C:\Program Files\Csound6_x64\include\csound\csound.hpp(437,39): warning C4244: 'return': conversion from 'int64_t' to 'long', possible loss of data
> > 1>   Creating library C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.lib and object C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.exp
> > 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: void __cdecl CsoundPerformanceThread::Play(void)" (?Play@CsoundPerformanceThread@@QEAAXXZ) referenced in function main
> > 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: void __cdecl CsoundPerformanceThread::Stop(void)" (?Stop@CsoundPerformanceThread@@QEAAXXZ) referenced in function main
> > 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: int __cdecl CsoundPerformanceThread::Join(void)" (?Join@CsoundPerformanceThread@@QEAAHXZ) referenced in function main
> > 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: __cdecl CsoundPerformanceThread::CsoundPerformanceThread(struct CSOUND_ *)" (??0CsoundPerformanceThread@@QEAA@PEAUCSOUND_@@@Z) referenced in function main
> > 1>csound_api_test.obj : error LNK2019: unresolved external symbol "public: __cdecl CsoundPerformanceThread::~CsoundPerformanceThread(void)" (??1CsoundPerformanceThread@@QEAA@XZ) referenced in function main
> > 1>C:\jana\csound\projects\csound_api_test\x64\Debug\csound_api_test.exe : fatal error LNK1120: 5 unresolved externals
> > 1>Done building project "csound_api_test.vcxproj" -- FAILED.
> > ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
> > 
> > #include 
> > #include "csound.hpp"
> > #include "csPerfThread.hpp"
> > 
> > int main(int argc, const char* argv[])
> > {
> >        int result = 0;
> >        Csound cs;
> >        result = cs.Compile(argc, argv);
> > 
> >        if (!result)
> >        {
> >                CsoundPerformanceThread perfThread(cs.GetCsound());
> >                perfThread.Play(); // Starts performance
> >                while (perfThread.GetStatus() == 0);
> >                // nothing to do here...
> >                // but you could process input events, graphics etc
> >                perfThread.Stop();  // Stops performance. In fact, performance should have
> >                                                        // already finished, so this is just an example of how
> >                                                        //to stop if you need
> >                perfThread.Join();  // always call Join() after Stop() as a rule of thumb.
> >        }
> >        else {
> >                printf("csoundCompile returned an error\n");
> >                return 1;
> >        }
> > 
> >        return 0;
> > }
> > 
> > Csound mailing list
> > Csound@listserv.heanet.ie
> > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flistserv.heanet.ie%2Fcgi-bin%2Fwa%3FA0%3DCSOUND&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C42b805a64b5a4364f65708d9604714c1%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637646680680422340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pPV0NuVXsZANA3dVc%2Fl4JyXj5VudGtWdOiZoiaC9AOc%3D&reserved=0
> > Send bugs reports to
> >        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissues&data=04%7C01%7CVictor.Lazzarini%40mu.ie%7C42b805a64b5a4364f65708d9604714c1%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637646680680422340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Q4JjByMpBjk67DXBVfo%2FevvKwYp8TXjVastvi6cTZiA%3D&reserved=0
> > Discussions of bugs and features can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here