Re: [Vala] Namespaces and Compiling With Multiple Source Files



On Mon, Sep 10, 2012 at 3:34 AM, Jonas Kulla <nyocurio gmail com> wrote:

2012/9/10 Landon Blake <sunburned surveyor gmail com>

I'm trying to compile and run a Vala program from two (2) vala source
files. I can compile the program with the following command:

valac geospatial_annotations.vala sutiv.vala -o
test_geospatial_annotations.vala

The sutiv.vala file contains the namespace "Sutiv". It defines a
couple of classes I use in geospatial_annotations.vala. I have "using
Sutiv" at the top of my geospatial_annotations.vala file.

The program compiles without errors. When I attempt to execute it with
the command "vala test_geospatial_annotations.vala" the interpreter
tells me "Namespace Sutiv could not be found."

Any ideas what I'm doing wrong. How do I compile a program that uses a
namespace defined in a separate source code file?

I can provide the source code files if needed.


Hi Landon,

The command you use to "compile" your code looks confusing to me.
AFAIK, valac will compile your vala source code to a binary executable,
therefore I don't understand why you give it the extension *.vala .

What happens if you just run the executable like this:

./test_geospatial_annotations.vala


Yeah, vala isn't an interpreted language (like Ruby or Python). You should
be able to do just do the following:

valac geospatial_annotations.vala sutiv.vala -o test_geospatial_annotations
./test_geospatial_annotations


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]