Another Studio peculiarity.

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If I right click on a .cpp file and click Compile, I'm not sure it compiles.  The message area says "nothing to be done for blink.d" no matter what .cpp I compile.

 

blink.cpp is the first file shown in Solution Explorer.  It is not where it belongs.  It's in a folder that Studio had previously created out of thin air.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Right click the file in the Solution Explorer, and select Properties.

 

In a properties-pane there will be a field called "action" or something like that. Does it say "compile"?

 

Sorry for the less-than-precise description - I'm not on Windows ATM, so no Studio available...

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now what?  When I right click on a .cpp in Visual Studio and click Compile, it compiles the file.  And WTF does blink.d have to do with anything?

 

 

Last Edited: Sun. Nov 5, 2017 - 11:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

steve17 wrote:
And WTF does blink.d have to do with anything?
The way make works is to look at the date/times on .c/.cpp files and only invoke the compiler/linker when it can "see" that the .c/.cpp has a later date than the .o (object) that it generates. If the .o has a later date/time then it was created after the .c/.cpp so it is up to date. This ensures that make does not build things that don't need building. But what if one of those .c/.cpp files has a #include of some header .h file and that HAS been edited (maybe some #define that switches on/off the building of some whole code section or things like that)? In this case the .c/.cpp must be rebuilt even though the file does not appear to have changed.

 

So how does make know which .h files to check to see if any of them have "new" date/times?

 

Well during the first build there are additional commands passed to the compilation which basically say "as the preprocessor runs and handles all the #include's it should build a list of all the .h files (possibly other filetypes too) that are #included so make has a list and knows what to check in future". Then on subsequent builds make not only checks the .c/.cpp themselves but usually there will be a .dep (dependencies) directory and within it a whole bunch of .d files which are the "lists of dependencies" for each .c/.cpp in the build.

 

So "blink.d" is going to be the dependency list for some source file called blink.c or blink.cpp. If interested simply "type" that file or load it into an editor. You should find that it is simply a list of .h files. The complete set that are used when blink.* does #include's and then some of those do #includes and then some of those do #include and so on...

 

In an Mfile template the creation of the .d files occurs because of:

# Compiler flags to generate dependency files.
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d

I'm not near a copy of Studio 7 to see what it actually puts into the makefile that it auto-generates but you are going to see similar options being used there. All those -MMD -MP -MF commands are documented on this page in the pre-processor manual:

 

https://gcc.gnu.org/onlinedocs/g...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It makes no sense that compiling usb.cpp would produce something about blink.d instead.  They are totally unrelated.  There are 34 .cpp files in the project. Why does blink show up there?  I don't think it compiles anything.

 

Here's what I get when I compile usb.cpp with Visual studio.