Csound Csound-dev Csound-tekno Search About

Re: [Csnd] [EXTERNAL] [Csnd] VS header file issue

Date2021-08-17 03:55
FromJana Cole
SubjectRe: [Csnd] [EXTERNAL] [Csnd] VS header file issue
Those instructions worked to create a .lib, csnd6.lib. I added it to the project and it runs. Nice to know I can make a .lib file next time I need to.

Jana

-----Original Message-----
From: A discussion list for users of Csound CSOUND@LISTSERV.HEANET.IE
Sent: Aug 16, 2021 12:14 PM
To: CSOUND@LISTSERV.HEANET.IE
Subject: Re: [Csnd] [EXTERNAL] [Csnd] VS header file issue


Actually the DLL is called csnd6.dll.  Not sure if there is a csnd6.lib, but you would need that to link to it.

Maybe someone with a windows machine can make you a csnd6.lib from the DLL, if there is not one.

Steps for this are (command-line):

1. Export the symbols

> dumpbin /EXPORTS csnd6.dll > csnd6.exports

2. Create a DEF file with a line at the top 

EXPORTS

followed by the contents of csnd6.exports

2. Create a lib file (for this you need to have the VC\/bin directory in your PATH

> lib /def:csnd6.def /machine:x64 /out:csnd6.lib

(source: https://stackoverflow.com/questions/9360280/how-to-make-a-lib-file-when-have-a-dll-file-and-a-header-file)

========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 16 Aug 2021, at 19:57, Victor Lazzarini  wrote:
> 
> The strncpy is not an error I think, just a warning, you can ignore it.
> 
> As csnd.lib, you should have at least a csnd.dll somewhere. It comes with Csound. If you don't, try installing the latest Csound.
> 
> The csnd.dll is the link library containing that code.
> 
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
> 
>> On Aug 16, 2021, at 7:22 PM, Jana Cole  wrote:
>> 
>> 
>> 
>> Re the API threading example:
>> 
>> I added csPerfThread.cpp, and it solved the linker issue and gave me some new messages: an error, saying strcpy (if I remember correctly) was unsafe and needed to be changed to strcpy_s. Also some warnings about conversions. 
>> 
>> 
>> I looked for csnd.lib, I did a search on my C:\Program Files\Csound6_x64\lib directory and found csound64.lib, libcsound64.lib and CsoundQt-d-html-cs6.lib.
>> 
>> I searched my csound-6.15.0 source code directory and found no lib files
>> 
>> Did a google search on "csnd.lib", didn't find anything.
>> 
>> Went to https://github.com/csound/csound. I'm not totally familiar with how it works, but I used the file finder and searched for csnd.lib and found nothing, then searched for *.lib and found nothing.
>> 
>> 
>> I imagine I missed csnd.lib somewhere. Where can it get it?
>> 
>> 
>> 
>> 
>> 
>> -----Original Message-----
>> 
>> From: A discussion list for users of Csound CSOUND@LISTSERV.HEANET.IE
>> 
>> Sent: Aug 16, 2021 12:50 AM
>> 
>> To: CSOUND@LISTSERV.HEANET.IE
>> 
>> Subject: Re: [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,  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%3DCSOUNDdata=04%7C01%7CVictor.Lazzarini%40mu.ie%7C42b805a64b5a4364f65708d9604714c1%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637646680680422340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=pPV0NuVXsZANA3dVc%2Fl4JyXj5VudGtWdOiZoiaC9AOc%3Dreserved=0
>> 
>> > Send bugs reports to
>> 
>> >        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcsound%2Fcsound%2Fissuesdata=04%7C01%7CVictor.Lazzarini%40mu.ie%7C42b805a64b5a4364f65708d9604714c1%7C1454f5ccbb354685bbd98621fd8055c9%7C1%7C0%7C637646680680422340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=Q4JjByMpBjk67DXBVfo%2FevvKwYp8TXjVastvi6cTZiA%3Dreserved=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.iehttps://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
>> 
>> 
>> 
>> 
>> 
>> ***************************
>> Thoughts are Things
>> ***************************
>> 
>> 
>> 
>> 
>> ***************************
>> Thoughts are Things
>> ***************************
>> 
>> 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


***************************
Thoughts are Things
***************************

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