[Csnd-dev] undefined reference to "csound_functions"
Date | 2016-03-31 01:57 |
From | SUBSCRIBE CSOUND Anonymous |
Subject | [Csnd-dev] undefined reference to "csound_functions" |
Hi, i'm trying to build examples from csoundAPI_examples-master using Codeblocks on Windows. I can't understand some things. The #include csound.h instruction works only with "" instead of <> I have to include also other headers (cfgvar.h, float-version.h, msg_attr.h, sysdep.h, text.h, version.h) I don' t know how to link csound64.dll I get "undefined reference to csound_functions" error message. |
Date | 2016-03-31 05:04 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
I don't use CodeBlocks, but I would recommend that you first try to get a simple example building from the command line. Take example1.c for instance. You should be able to build from the command line with something along the lines of: gcc example1.c -o csoundAPItest.exe -I"C:/Path to Csound folder/Include"
-L"C:/Path to Csound folder/bin" -lcsound64 Make sure you pass the correct paths in the above command. I can't recall if you need to add .dll to the csound64 on Windows. And I'm not on a Windows machine right now. If the above doesn't work one of these may: gcc example1.c -o csoundAPItest.exe -I"C:/Path to Csound folder/Include" -L"C:/Path to Csound folder/bin" -lcsound64.dll gcc example1.c -o csoundAPItest.exe -I"C:/Path to Csound folder/Include" -L"C:/Path to Csound folder/bin" csound64.dll Obviously you have to make sure you are in the directory that contains example1.c before calling that command. With regards to your other questions: - You mostly don't need to include anything but csound.h - See here fore details on whether you should use <> or ". <> will work fine so long as you added the include path when building the application. (as is shown in the build command above) - Linking is done with -l but you need to tell the compiler where the library is located using -L (see build command above) - Undefined references are a sure sign that the compiler can't find a library, in this case csound64.dll. If it still doesn't work, reply with both the command that you tried, and the output from the compiler and we'll see if we can figure it out. On 31 March 2016 at 01:57, SUBSCRIBE CSOUND Anonymous <cristiano.piatti@gmail.com> wrote: Hi, |
Date | 2016-03-31 14:53 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
gcc example1.c -o csoundAPItest.exe -I"C:/Path to Csound folder/Include" -L"C:/Path to Csound folder/bin" -lcsound64 does work but when executing the .exe it does not find python27.dll even if it is in C:\Windows\SysWOW64 and Python 2.7.11 is installed (Windows 8.1). It does work on Windows 7 32bit. Many thanks. 2016-03-31 6:04 GMT+02:00 Rory Walsh |
Date | 2016-03-31 16:26 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
maybe you can remove py.dll from the Csound folder if you don't need it? I think that might be what is causing the python issue? On 31 March 2016 at 14:53, cristiano piatti <cristiano.piatti@gmail.com> wrote: gcc example1.c -o csoundAPItest.exe -I"C:/Path to Csound |
Date | 2016-03-31 21:39 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
py.dll removed. Now it works. Thanks a lot. 2016-03-31 17:26 GMT+02:00 Rory Walsh |
Date | 2016-04-01 18:42 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
Hi, about "Introduction to using the Csound Host API", have i to convert csound64.dll to libcsound64.a also under windows ? I added include and library paths but the IDE does not find the library. Could you please suggest me an IDE ? Are there somewhere some API examples about real time input/output, socket receive or OSC, using Csound code inside a project ? Many Thanks again. 2016-03-31 22:39 GMT+02:00 cristiano piatti |
Date | 2016-04-01 23:21 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
You don't need to do that. If it's building from the command line then you are for to go. What's the error you are getting? On 1 Apr 2016 6:42 pm, "cristiano piatti" <cristiano.piatti@gmail.com> wrote:
Hi, |
Date | 2016-04-02 11:51 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
HI, the error is "undefined reference to all the "csound_functions" in the source.c (with Code Blocks under Windows). Do i need a .lib also ? 2016-04-02 0:21 GMT+02:00 Rory Walsh |
Date | 2016-04-02 12:53 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
No. My point is that if you were able to build from the command line then you already have everything you need. I don't use an IDE on Windows. So I can't comment on CodeBlocks or anything else. But I'm pretty sure that all you need to do is add the paths to the Csuond include files, and then select the csound64.dll as the library to link against. On 2 April 2016 at 11:51, cristiano piatti <cristiano.piatti@gmail.com> wrote: HI, |
Date | 2016-04-03 13:50 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
Hi, now i' have understood. I finally added the .dll (Project > build options > Linker setting > Link libraries...instead of adding it trough the path because it does not not work) and it does work on Windows 7_32bit. There is only a problem building the examples on Windows 8.1, i get "control reaches end of non void function" error message. 2016-04-02 13:53 GMT+02:00 Rory Walsh |
Date | 2016-04-03 13:59 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
What compiler are you using to build? Is it the same for Win7 as Win8.1? And can you remind me again if you are using the same Csound library on each OS? If so, which one is it? Apologies if you've already provided this info but I just don't have time today to go trawling through the archives ;) On 3 April 2016 at 13:50, cristiano piatti <cristiano.piatti@gmail.com> wrote: Hi, |
Date | 2016-04-03 15:07 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
What compiler are you using to build? Code Blocks (codeblocks-16.01mingw-setup.exe) Is it the same for Win7 as Win8.1? Yes using the same Csound library on each OS? Yes which one is it? Csound6.06 (source code downloaded from https://sourceforge.net/projects/csound/files/csound6/Csound6.06/Csound6.06.zip/download) Thank you very much for your time and courtesy. 2016-04-03 14:59 GMT+02:00 Rory Walsh |
Date | 2016-04-03 15:15 |
From | Michael Gogins |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
Are you building for 64 bit CPU architecture (also known as x64) or for 32 bit CPU architecture (also known as x86)? Csound, the application using Csound, and the compiler all have be the same CPU architecture. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Sun, Apr 3, 2016 at 5:07 PM, cristiano piatti |
Date | 2016-04-03 15:19 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
Ok...this is the problem... 64 bit CPU architecture on Windows 8.1 32 bit CPU architecture in Windows 7 2016-04-03 16:15 GMT+02:00 Michael Gogins |
Date | 2016-04-03 15:21 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
many thanks. 2016-04-03 16:19 GMT+02:00 cristiano piatti |
Date | 2016-04-03 15:21 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
No it's not. You can still work with 32bit libraries and compilers on a 64bit version of Windows. On 3 April 2016 at 15:19, cristiano piatti <cristiano.piatti@gmail.com> wrote: Ok...this is the problem... |
Date | 2016-04-03 15:23 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
I'm not really sure what the problem is. Your build tools seem fine. You're using 32bit compilers and Csound binaries, which should work fine on 64bit versions of Windows. From the command line it works fine? Are you sure the gcc called from the command line is the same one that is called from CodeBlocks? Do you install mingw32 on its own on top of the one that ships with CodeBlocks? On 3 April 2016 at 15:21, Rory Walsh <rorywalsh@ear.ie> wrote:
|
Date | 2016-04-03 15:26 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
>From the command line it works fine? Yes Are you sure the gcc called from the command line is the same one that is called from CodeBlocks? Yes Do you install mingw32 on its own on top of the one that ships with CodeBlocks? No but there's a MSYS2/MinGW64 installed before 2016-04-03 16:23 GMT+02:00 Rory Walsh |
Date | 2016-04-03 15:27 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
Are you sure the gcc called from the command line is the same one that is called from CodeBlocks? No 2016-04-03 16:26 GMT+02:00 cristiano piatti |
Date | 2016-04-03 15:29 |
From | Michael Gogins |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
Just to be clear, Windows 8 and most versions of WIndows 7 are both 32 bit and 64 bit operating systems. They can run programs that are compiled either for 32 bit CPU architecture or for 64 bit CPU architecture. And you can get compilers for both 32 bit and 64 CPU architecture on WIndows 8 and most versions of WIndows 7. MSVC 2013 and later comes with both compilers. I don't know about CodeBlocks. You might have to download a specific version or install a specific version of the compiler. My remarks are NOT about the operating system. They are about the compiler, the Csound library, and the application that uses the Csound library. Hope this helps, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Sun, Apr 3, 2016 at 5:23 PM, Rory Walsh |
Date | 2016-04-03 15:33 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
If it builds from the command line and runs without any problem then I suspect that CodeBlocks is not using the same compiler? Otherwise they would behave the exact same. How did you confirm the command line gcc is the same as the codeblocks one? On 3 April 2016 at 15:29, Michael Gogins <michael.gogins@gmail.com> wrote: Just to be clear, Windows 8 and most versions of WIndows 7 are both 32 |
Date | 2016-04-03 15:43 |
From | Michael Gogins |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
It has a configuration dialog that displays the compiler paths. Regards, On Apr 3, 2016 5:34 PM, "Rory Walsh" <rorywalsh@ear.ie> wrote:
|
Date | 2016-04-03 15:45 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
In that case I'm stumped. Is CodeBlocks trying to automatically tun it through the debugger perhaps? Can you try running the CodeBlocks built binary from the command line? Does it also give the same error? On 3 April 2016 at 15:43, Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2016-04-03 15:50 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
How did you confirm the command line gcc is the same as the codeblocks one? I have uninstalled MSYS2/MinGW64 and tried again...but it's the same 2016-04-03 16:45 GMT+02:00 Rory Walsh |
Date | 2016-04-03 16:00 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
I'm afraid I can't offer much more help on this. If you really need to use CodeBlocks then you'll have to keep digging away at it until you find the problem. At least you can always fall back on the working version from the command line. On 3 April 2016 at 15:50, cristiano piatti <cristiano.piatti@gmail.com> wrote: How did you confirm the command line gcc is the same as the codeblocks one? |
Date | 2016-04-03 16:07 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
It' s okay, thanks a lot again for all your advises...now i have a more clear idea. The last think, some API examples about socket receive or OSC and real time audio I/O... All the best. 2016-04-03 17:00 GMT+02:00 Rory Walsh |
Date | 2016-04-03 16:34 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
Does the same thing happen to all examples you try to build? On 3 April 2016 at 16:07, cristiano piatti <cristiano.piatti@gmail.com> wrote: It' s okay, thanks a lot again for all your advises...now i have a |
Date | 2016-04-03 19:01 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
Does the same thing happen to all examples you try to build? Yes 2016-04-03 17:34 GMT+02:00 Rory Walsh |
Date | 2016-04-03 19:18 |
From | jpff |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
Which non-void function? On Sun, 3 Apr 2016, cristiano piatti wrote: > Hi, > now i' have understood. > I finally added the .dll (Project > build options > Linker setting > > Link libraries...instead of adding it trough the path because it does > not not work) and it does work on Windows 7_32bit. > There is only a problem building the examples on Windows 8.1, i get > "control reaches end of non void function" error message. |
Date | 2016-04-03 19:31 |
From | cristiano piatti |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
Which non-void function? it is not specified...for all the examples i tried to build, the compiler points to the main end curly bracket. 2016-04-03 20:18 GMT+02:00 jpff |
Date | 2016-04-04 11:22 |
From | jpff |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
then the main function needs a return 0; at the end. i thought in ANSI C one was allowed to oit tat, but cleary not for your compiler On Sun, 3 Apr 2016, cristiano piatti wrote: > Which non-void function? > it is not specified...for all the examples i tried to build, the > compiler points to the main end curly bracket. > > 2016-04-03 20:18 GMT+02:00 jpff |
Date | 2016-04-04 11:47 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
I’ve added “return 0” to the C API examples. ======================== Dr 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 4 Apr 2016, at 11:22, jpff |
Date | 2016-04-04 11:52 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
After all that! The problem was a missing return. I didn't even think to look at the actual examples. I better check my examples and see if they are Ok! On 4 April 2016 at 11:47, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: I’ve added “return 0” to the C API examples. |
Date | 2016-04-04 11:52 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] undefined reference to "csound_functions" |
I'm Ok. Turns out I must have been listening to whoever it was that first showed me C ;) On 4 April 2016 at 11:52, Rory Walsh <rorywalsh@ear.ie> wrote:
|