Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error CS1032: Cannot define/undefine preprocessor symbols after first token in file #36

Open
hannehuygelier opened this issue Jan 9, 2020 · 10 comments

Comments

@hannehuygelier
Copy link

Dear developer(s) of labstreaminglayer,

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.

When googling the error I found something on the .NET page (https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs1032), but this is not comprehensible to me.

Do you have any ideas on how to solve this issue?

Thanks anyway for developing this great tool!
Kind regards,
Hanne Huygelier

@cboulay
Copy link
Collaborator

cboulay commented 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
Copy link
Author

hannehuygelier commented 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:

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?

Thanks in advance!

@cboulay
Copy link
Collaborator

cboulay commented 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
Copy link
Author

Windows 10 and architecture X86_64.

@cboulay
Copy link
Collaborator

cboulay commented 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
Copy link
Author

The errors that come up are all similar like this one:

The namespace 'ConsoleApplication1' already contains a definition for 'Program'

This error pops up from each of the scripts in the examples that define "ConsoleApplication1".

@cboulay
Copy link
Collaborator

cboulay commented 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
Copy link
Collaborator

cboulay commented 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
Copy link
Author

Ah okay, I am sorry for bothering you.

@cboulay
Copy link
Collaborator

cboulay commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants