Jump to content
  • Advertisement

Recommended Posts

HI

I try to compile some code and get "expected { in VC Community edition at line:

    static void setup_texture_filter(GLuint tex, GLint miplevels, GLint int_fmt,
        GLsizei width, GLsizei height, GLenum format, GLenum type,
        const GLvoid* data, GLint mag_filter, GLint min_filter) UNUSED_ATTR;

 

in the header:

#define    UNUSED_ATTR    __attribute__((unused))
#define    UNUSED(x)    (void)(x)

 

I don't understand those define and all code. Many thanks

 

Share this post


Link to post
Share on other sites
Advertisement

The  #define is just used as a text replacement. So everywhere UNUSED_ATTR occurs, it is replaced by __attribute__((unused)) before the compiler starts working. This is usually done to add compiler or system dependent code. 

__attribute__((unused)) itself just suppresses a compiler warning that this function was never used:

http://www.keil.com/support/man/docs/armclang_ref/armclang_ref_chr1393261558987.htm

From the compiler error, I would guess, that the semicolon is somehow not recognized. Try moving the semicolon to the next line or just place a space between the macro and the semicolon.

Greetings

Share this post


Link to post
Share on other sites
Posted (edited)

Yes seems so. Now I have in cpp:

librain_draw_prepare(FALSE);

and get error:

identifier not found

in the header:

LIBRAIN_EXPORT void librain_draw_prepare_all(void);

 

also in cpp:

static mat4 glob_proj_matrix = GLM_MAT4_IDENTITY;

i get error:

vec4 cannot be used to initialise typ float

in header:

#define GLM_MAT4_IDENTITY ((mat4)GLM_MAT4_IDENTITY_INIT)

 

Could I use mingw in VS community edition? Many thanks for help.

 

 

Edited by ePitts

Share this post


Link to post
Share on other sites
2 hours ago, Shaarigan said:

I could be wrong but isn't


__attribute__

a GCC compiler token and not MSVC?

That's probably why the #define UNUSED_ATTR is used in the first place. I would guess, that there is somewhere in the code an #ifdef MSVC block which defines it to be empty and the TS just posted the version he found first (in this case the GCC version).

Additional Info: Since C++17 there is a standard attribute to silence "unused" warnings: [[maybe_unused]]. This should work for any compiler but isn't backward compatible.

 

@TS:

Which library/code are you trying to compile? Maybe there is a documentation about supported compilers/systems and known issues.

 

2 hours ago, ePitts said:

Could I use mingw in VS community edition? Many thanks for help.

I can't answer this question, but from the general Microsoft policy, I would guess that there is no initial support. Maybe some plugins that do that are available.

Here is a stackoverflow link related to this question:

https://stackoverflow.com/questions/14768073/how-to-use-gcc-with-microsoft-visual-studio

 

Greetings

Share this post


Link to post
Share on other sites

*shudder*

A hairy piece of code with all those defines ... who knows where they are defined, in the code, the environment, passed in as compiler options ... coming from elsewhere.

The #define glm_mat4_identity seems nonsensical to me, the glm::mat4() default constructor returns an indentity matrix ...

 

Share this post


Link to post
Share on other sites

So to get this clerified, you definitely have a problem with the preprocessor. To solve this you should either download a fress version and follow the instructions or dig through the code and find some configuration header to see where the problem comes from. I know Visual Studio 2017 is capable of detecting via Intellisense where a certain macro was defined in the code so maybe you are walking the path back until you find the broken line

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!