Error when compiling: "attribute not allowed"

Asked

Viewed 63 times

0

I’m having trouble compiling a program in Visual C++ and as a beginner, I can’t find where the error is.

The program is running perfectly in Codeblocks. What might be the problem?

Follow the error report:

relatório do erro

  • 2

    Good afternoon Lucas, post the code, code images are more difficult to reproduce, if something can be text then use text, really it is complicated to take a picture of the code right? I hope you’ll take this as a positive criticism.

  • 1

    You only posted a small chunk of code (and as an image, just to make it worse). It’s hard to understand what your problem is without having all the code to analyze.

  • This was my first post and I was not aware of these situations, the problem has already been solved thanks to the answer of the colleague below and on the next occasions I will be attentive to these particularities. Thank you.

1 answer

1


The problem is that you are using the C++/CLI compiler, which is a managed language that uses .NET. This is not the C++ language you expect, it’s another one. You need to configure Visual Studio to use standard C++ .

You must have chosen a wrong design model. See how it should be according to the documentation.

For example, it was you who put this STAThreadAttribute? Is it in the code that is running on Codeblocks? If not, take it away.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.