0
votes

I want to build a flex library project directly through the mxmlc compiler. My library has one .as file and it is under a package call com.test

package com.test { public class Main {  public function Main(){...

I run the following command on the cmd

D:\4.11.0\bin\mxmlc D:\TestLibrary\src\com\test\Main.as

But it gives me the following error

Error: A file found in a source-path must have the same package structure '', as the definition's package, 'com.test'

If I remove the package definition from the script as follows, it works.

package { public class Main { ...

My question is why this happen and how to fix it?

2

2 Answers

2
votes

You need to additionally tell the compiler the root of your sources:

mxmlc D:\TestLibrary\src\com\test\Main.as -source-path D:\TestLibrary\src\

by providing the "source-path" property you are telling the compiler where the root is and releative from that it now should know that com.test.Main is the relative path to your class.

0
votes

Thanks Charisofer, Finally I could build the library project and make the swc file. This is the command I used. Hope it will help for others.

D:\4.11.0\bin\compc -source-path D:\TestLibrary\src -include-sources D:\TestLibrary\src\com\test\Main.as -debug=false -output D:\Auto_Release\main.swc

To build swf, need to use mxmlc

To build swc need to use compc