msdn sample

Oct 24, 2010 at 5:46pm
i am trying to run some example code on msdn and i have an error, some one tell me what it means...
1
2
3
4
5
6
c:\users\kyle11778\desktop\samplefilewatchsolution\samplefilewatch\samplefilewatch.cpp(5) : fatal error C1190: managed targeted code requires a '/clr' option

//which points to:

#using <System.dll>

Oct 24, 2010 at 5:59pm
You are trying to compile a C++/CLI program with the C++ compiler
If you want to use C++/CLI ( which I remind you is a different language ) you need to enable the /clr option as the error message suggests
Oct 24, 2010 at 6:10pm
right... where do i do that?
i am using visual studio 2008 c++
Oct 24, 2010 at 9:08pm
start CLR project
Oct 25, 2010 at 3:00am
CLR empty project or CLR Console Application? does it matter? do most of the examples on msdn written with the CLR projects or does it just depend on what you are doing?

thanks by the way... :)

i found the right one... :)

in the program:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public ref class Watcher
{
private:
   // Define the event handlers.
   static void OnChanged( Object^ /*source*/, FileSystemEventArgs^ e )
   {
      // Specify what is done when a file is changed, created, or deleted.
      Console::WriteLine( "File: {0} {1}", e->FullPath, e->ChangeType );
   }

   static void OnRenamed( Object^ /*source*/, RenamedEventArgs^ e )
   {
      // Specify what is done when a file is renamed.
      Console::WriteLine( "File: {0} renamed to {1}", e->OldFullPath, e->FullPath );
   }

public:


what do i put for line 5 "/*source*/"
Last edited on Oct 25, 2010 at 4:06am
Oct 26, 2010 at 10:19pm
so i got this to works after some time. now i was wondering why this doesn't respond to last accessed? creating and deleting works fine though.

any ideas? thanks

also(this may be the cause)... i opened a file-closed it-then viewed the properties and last access didn't change! using windows 7. anyone know why?
Last edited on Oct 26, 2010 at 10:28pm
Topic archived. No new replies allowed.