Csound Csound-dev Csound-tekno Search About

[Csnd] unresolved extrnal

Date2019-05-01 22:12
FromPaul Sam <0000051babdc3af5-dmarc-request@LISTSERV.HEANET.IE>
Subject[Csnd] unresolved extrnal
I am trying to run the example API program in Visual C++ (Windows). I get a number of errors of this type when I try to compile:

 error LNK2019: unresolved external symbol _csoundCreate referenced in function _main

I have csound64.lib listed under Project Properties > Linker > Additional Dependencies

And I have the cound64.dll file in the Debug folder (where the .exe file will be).

What am I doing wrong?




Here is the code I am trying to run:


#include "pch.h"
#include 

#include "C:\Program Files\Csound6_x64\include\csound\csound.h"

const char *orc_text =
"instr 1 \n"
" out(linen(oscili(p4,p5),0.1,p3,0.1)) \n"
"endin \n";
const char *sco_text = "i1 0 5 1000 440 \n";

int main()
{
    std::cout << "Hello World!\n"; 

	CSOUND *csound = csoundCreate(0);
	int result = csoundSetOption(csound, "-d");
	result = csoundSetOption(csound, "-odac");
	result = csoundStart(csound);
	result = csoundCompileOrc(csound, orc_text);
	result = csoundReadScore(csound, sco_text);
	while (1) {
		result = csoundPerformKsmps(csound);
		if (result != 0) {
			break;
		}
	}
	result = csoundCleanup(csound);
	csoundReset(csound);
	csoundDestroy(csound);
	return result;
}

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

Date2019-05-02 09:29
FromRory Walsh
SubjectRe: [Csnd] unresolved extrnal
Looks like it's not finding the Csound library. Did you add the path
to the Csound library in the 'Additional LibraryDirectories' field in
the Linker->General settings? FWIW, there is a simple VS project
available here:
https://github.com/csound/csoundAPI_examples/tree/master/cpp
That should build out of the box on Windows.

On Wed, 1 May 2019 at 22:22, Paul Sam
<0000051babdc3af5-dmarc-request@listserv.heanet.ie> wrote:
>
> I am trying to run the example API program in Visual C++ (Windows). I get a number of errors of this type when I try to compile:
>
>  error LNK2019: unresolved external symbol _csoundCreate referenced in function _main
>
> I have csound64.lib listed under Project Properties > Linker > Additional Dependencies
>
> And I have the cound64.dll file in the Debug folder (where the .exe file will be).
>
> What am I doing wrong?
>
>
>
>
> Here is the code I am trying to run:
>
>
> #include "pch.h"
> #include 
>
> #include "C:\Program Files\Csound6_x64\include\csound\csound.h"
>
> const char *orc_text =
> "instr 1 \n"
> " out(linen(oscili(p4,p5),0.1,p3,0.1)) \n"
> "endin \n";
> const char *sco_text = "i1 0 5 1000 440 \n";
>
> int main()
> {
>     std::cout << "Hello World!\n";
>
>         CSOUND *csound = csoundCreate(0);
>         int result = csoundSetOption(csound, "-d");
>         result = csoundSetOption(csound, "-odac");
>         result = csoundStart(csound);
>         result = csoundCompileOrc(csound, orc_text);
>         result = csoundReadScore(csound, sco_text);
>         while (1) {
>                 result = csoundPerformKsmps(csound);
>                 if (result != 0) {
>                         break;
>                 }
>         }
>         result = csoundCleanup(csound);
>         csoundReset(csound);
>         csoundDestroy(csound);
>         return result;
> }
>
> 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