Visual Studio False Build Errors

Max Denning 21 Reputation points
2021-04-18T06:43:19.833+00:00

I am working on a C++ project and am having trouble with false build errors. This used to happen every once in a while but usually restarting VS would be enough to fix it however, this time it hasn't worked. I have looked into this and have tried following many suggestions like deleting my .vs file, re-installing VS, and trying to turn off the IntelliSense errors (this does lower the amount of false errors), however I am still not have to compile my program.

This problem seems to stem from one cpp file since this used to happened when I made changes to it. This file is a decent size and uses a decent amount of macros (I am not sure if that has anything to do with it)

Any ideas? I can post code if necessary.

Developer technologies C++
{count} votes

Accepted answer
  1. WayneAKing 4,931 Reputation points
    2021-04-19T02:11:17.927+00:00

    A couple of things that look problematic to me:

    (1) In ecs.cpp this line is ill-formed:

    void (u_int id, float rad, float h_rad){

    It appears to be missing a function name.

    (2) typedef unsigned int u_int;

    You may be having an issue with the use of typedef to
    define a type that is used in macros. Macros are
    processed by the preprocessor before the compiler
    takes over. But typedefs are processed by the
    compiler. So a typedef won't be effective for
    macro use - you need to use a #define instead.

    #define u_int unsigned int
    
    • Wayne
    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. WayneAKing 4,931 Reputation points
    2021-04-18T18:07:46.567+00:00

    If you wish to share the code and project files (properties,
    etc.) so others can try to replicate the errors, the usual
    procedure is to post all relevant files to a file sharing
    service such as Microsoft's OneDrive. Then post a link to
    that code in a reply here in the forums. Obviously you
    can invalidate the link and/or delete the files once
    the problem has been resolved (or abandoned).

    However, as Viorel-1 has suggested, you should at least
    give us some clue as to what the exact errors are
    that you are seeing. Just saying that you get errors
    is hardly sufficient for a diagnosis. It's also needed
    if someone tries to build your code. How are they to
    know exactly what errors they are supposed to expect?

    • Wayne
    0 comments No comments

  2. Max Denning 21 Reputation points
    2021-04-18T18:57:08.413+00:00

    Sorry for the lack of information, it is my first time posting. I attached a link to a zip file of my project on my google drive. The file that seems to be causing most of the issues is ecs.cpp. It seems like it does not recognize I am including ecs.h. Some other issues might show up since I have some paths are that go to files on my pc, so those might show up as errors. I attached an images for what some of my errors look like:
    88881-vs-error.png

    Here are my errors without IntelliSense:88835-vs-error-2.png

    It seems really anger when I have u_int, however I redefined that in ecs.h so it shouldn't be an issue. Let me know if you need any more info.

    (I deleted the google drive link)


  3. Max Denning 21 Reputation points
    2021-04-18T23:36:57.023+00:00

    Whoops I guess I thought that link would allow access. Does this one drive link work?

    (link removed)

    0 comments No comments

  4. Max Denning 21 Reputation points
    2021-04-19T03:26:14.383+00:00

    It looked like changing the typedef unsigned int u_int to #define u_int unsigned int pretty much fixed everything. All my errors have disappeared after I deleted my .vs folder. I had been working with typedef unsigned int u_int for a while, but I can see how this caused an issue.

    I am not sure how my function name got removed, but I fixed that too.

    Thank you so much!!!!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.