You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
error CS1032: Cannot define/undefine preprocessor symbols after first token in file #36
I want to log head orientation data at a relatively high frequency in my Unity application and found your tool, which seems the perfect thing to solve my issue!
However, when following your wiki instructions on integrating LSL into my Unity project, I immediately got an error. When I place the folders of LSL into my assets folder in Unity, the following error compes up:
Assets\LSL4Unity\LSL.cs(5,2): error CS1032: Cannot define/undefine preprocessor symbols after first token in file
I am assume this is some compatibility issue with .NET? I am using Unity version 2019.1.2f1 Personal with .NET 4.x Equivalent.
I cannot downgrade .NET, because I had to upgrade to solve some other bugs. I also cannot easily check whether things work in a different Unity version, because I am using Oculus utilities and they don't always work well in different Unity versions.
There was a recent change to LSL.cs (commit here). I'm not sure why it was added but it causes this problem for us too. @Argzero do you think you could remove it and find another solution to your issue?
In any case, if all you need is LSL.cs, then please use the version here: https://github.com/labstreaminglayer/liblsl-Csharp
Eventually this will be the only version of LSL.cs and this LSL4Unity repo will have to be refactored somewhat to use that LSL.cs, though I don't know how to do that just yet.
I changed the LSL version to the one you recommended.
However, I now get a new error:
error CS1519: Invalid token '=' in class, struct, or interface member declaration
I noticed that it was because there was no "const string" before liblsl, so I adjusted that on lines 888 and 885, but this just gives rise to many new errors.
So I am assuming the current LSL version is not compatible with .Net 4.0 or with something else in my project?
You're right about the const string, sorry for missing that before. My tests of that LSL.cs file were in a regular C# project, not Unity, so that #if block wasn't triggered.
But, after adding that, my colleague just tested LSL.cs in his Unity project with .Net 4.x and it worked fine.
Ah, sorry I can't help you with LSL4Unity examples. In our Unity projects we only use LSL.cs (and the required liblsl64.dll). I think it's completely possible that the LSL4Unity examples are out-dated and might not work with the latest Unity and/or latest .Net framework.
The good news is that LSL.cs (and the dll) work fine in Unity and really that's all you need to get going with LSL in Unity.
I just realized that you might have been referring to the examples in liblsl-Csharp. Those are not intended to be used in Unity. Those are intended to be used as standalone C# executables.
Not at all. In the "Getting Help" paragraph in the main repository (here), there's a link for a Slack invite. Please join if you'd prefer a real-time conversation over the back-and-forth in GitHub issues.
Activity
cboulay commentedon Jan 9, 2020
There was a recent change to LSL.cs (commit here). I'm not sure why it was added but it causes this problem for us too. @Argzero do you think you could remove it and find another solution to your issue?
In any case, if all you need is LSL.cs, then please use the version here: https://github.com/labstreaminglayer/liblsl-Csharp
Eventually this will be the only version of LSL.cs and this LSL4Unity repo will have to be refactored somewhat to use that LSL.cs, though I don't know how to do that just yet.
hannehuygelier commentedon Jan 9, 2020
Thank you for the quick response!
I changed the LSL version to the one you recommended.
However, I now get a new error:
I noticed that it was because there was no "const string" before liblsl, so I adjusted that on lines 888 and 885, but this just gives rise to many new errors.
So I am assuming the current LSL version is not compatible with .Net 4.0 or with something else in my project?
Thanks in advance!
cboulay commentedon Jan 9, 2020
It's compatible. That's not the problem.
I guess you're just on a code path that I didn't test. What OS and architecture are you on?
hannehuygelier commentedon Jan 9, 2020
Windows 10 and architecture X86_64.
cboulay commentedon Jan 9, 2020
You're right about the
const string, sorry for missing that before. My tests of that LSL.cs file were in a regular C# project, not Unity, so that #if block wasn't triggered.But, after adding that, my colleague just tested LSL.cs in his Unity project with .Net 4.x and it worked fine.
hannehuygelier commentedon Jan 9, 2020
The errors that come up are all similar like this one:
This error pops up from each of the scripts in the examples that define "ConsoleApplication1".
cboulay commentedon Jan 9, 2020
Ah, sorry I can't help you with LSL4Unity examples. In our Unity projects we only use LSL.cs (and the required liblsl64.dll). I think it's completely possible that the LSL4Unity examples are out-dated and might not work with the latest Unity and/or latest .Net framework.
The good news is that LSL.cs (and the dll) work fine in Unity and really that's all you need to get going with LSL in Unity.
cboulay commentedon Jan 9, 2020
I just realized that you might have been referring to the examples in liblsl-Csharp. Those are not intended to be used in Unity. Those are intended to be used as standalone C# executables.
hannehuygelier commentedon Jan 9, 2020
Ah okay, I am sorry for bothering you.
cboulay commentedon Jan 9, 2020
Not at all. In the "Getting Help" paragraph in the main repository (here), there's a link for a Slack invite. Please join if you'd prefer a real-time conversation over the back-and-forth in GitHub issues.