CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Nov 2006
    Posts
    120

    Setting dependencies to compile generated .c files

    Hi,

    Wow - long time since using visual studio and my brain is incredibly rusty!

    So... I have a VC++ project - it's all C++, except for a couple of .c files generated by flex and bison (I got the flexbison.rules file from Microsoft: http://msdn.microsoft.com/en-us/libr...ustombr_topic3).

    How do I tell Visual Studio (2008), that the .c files are part of the project and must be compiled so that the linker can link them to produce the .exe? Of course I could add the to the source file section, but that doesn't seem quite right somehow, as they are generated anew each time the .y and .l files (the flex and bison sources) are modified.

    Thanks in advance

    Mark

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Setting dependencies to compile generated .c files

    Of course I could add the to the source file section, but that doesn't seem quite right somehow, as they are generated anew each time the .y and .l files (the flex and bison sources) are modified.
    Don't understand what these 2 have to do together. The studio compiles the c-files in your project, so, or you add them like you do with all your files that you want to compile, or you include them in another file. Big drawback of that is that c-files aren't supposed to be included in other files.

  3. #3
    Join Date
    Nov 2006
    Posts
    120

    Re: Setting dependencies to compile generated .c files

    OK, but they are not really sources - they are generated files that I never want to open in the editor. Also "Build/Clean Solution" should delete them.

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Setting dependencies to compile generated .c files

    Adding files to a project doesn't mean that you have to open (edit) them, it just mean that they shall be built and linked with your other files.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured