Page 1 of 1

Problem with WPF

PostPosted: Sat Oct 20, 2012 6:20 am
by kibkib
Hi,

I just installed Cobra 0.9.1 on my Windows 8 64bits machine, but trying to launch the Notepad sample app gave me the following:

Code: Select all
C:\Users\Christophe\Desktop\Cobra\Samples>cobra Notepad.cobra
Notepad.cobra(8,83): error: Cannot find "'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0'" as a file.
Compilation failed - 1 error, 0 warnings
Not running due to errors above.


Any idea ? Thanks.

Note that I've edited the sample occording to my path by changing this line:
Code: Select all
@args -lib: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0'

Re: Problem with WPF

PostPosted: Sun Oct 21, 2012 3:48 am
by Charles
I tried on Win 7 Ultimate 64-bit with .NET 4.0 (or 4.5). It did not work right away, but with some fiddling, I got there. I had to change the -lib path and add a ref to System.Xaml. Also I changed the order of the refs to WindowsBase, PresentationCore and PresentationFramework which reflects their complexity from simplest to most complex--at least based on what I read.

@args lib:'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0'

@ref 'WindowsBase'
@ref 'PresentationCore'
@ref 'PresentationFramework'
@ref 'System.Xaml'


Give it a try and let me know. You can check what version of .NET Cobra is running on with "cobra -about". Mine says:
Code: Select all
The Cobra Programming Language svn:2826 (post 0.9) / 2012-10-21
on .NET CLR v4.0.30319 on Microsoft Windows NT 6.1.7601 Service Pack 1
at C:\Cobra\Cobra-svn-2826\bin\cobra.exe


What does yours say?

Re: Problem with WPF

PostPosted: Sun Oct 21, 2012 4:47 am
by kibkib
Hi Charles,

and thanks for your answer. I've tried your changes without success. Here's the console output:

Code: Select all
C:\Users\Christophe\Desktop\Cobra\Samples>cobra Notepad.cobra
Notepad.cobra(8,97): error: Cannot find "'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0'" as a file.
Compilation failed - 1 error, 0 warnings
Not running due to errors above.


I'm asking why cobra wants this as a file: it is a folder full of dlls.

My version of Cobra told me the following:
Code: Select all
C:\Users\Christophe\Desktop\Cobra\Samples>cobra -about

The Cobra Programming Language 0.9.1
on .NET CLR v4.0.30319 on Microsoft Windows NT 6.2.9200.0
at C:\Cobra\Cobra-0.9.1\bin\cobra.exe

Re: Problem with WPF

PostPosted: Sun Oct 21, 2012 10:07 am
by Charles
Can you copy and paste that directory name and do a "dir" on it and include the output?

Can you attach your Notepad.cobra file?

Make sure there is a dash (-) before the lib. I notice the Cobra syntax highlighter is eating it, so my example code may be misleading.

Re: Problem with WPF

PostPosted: Sun Oct 21, 2012 10:38 am
by kibkib
Ok,

so here's the contents of the directory :
http://kib2.free.fr/pastebin/view_paste.php?id=76

And here's my Notepad.cobra file (I'll use my own pastebin with a quickly done Cobra syntax). Notice that I had the dash before the 'lib':
http://kib2.free.fr/pastebin/view_paste.php?id=77

Re: Problem with WPF

PostPosted: Sun Oct 21, 2012 5:57 pm
by Charles
You have a space between "-lib:" and "'C:\...".

Consequently, the path is treated as just another file being passed to Cobra. Eliminate the space and you should be good.

Re: Problem with WPF

PostPosted: Mon Oct 22, 2012 3:46 am
by kibkib
Thanks Charles, it works like a charm now.