ANJ
ANJ

Reputation: 301

Build flex library using mxmlc

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?

Upvotes: 0

Views: 655

Answers (2)

ANJ
ANJ

Reputation: 301

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

Upvotes: 0

Christofer Dutz
Christofer Dutz

Reputation: 2365

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.

Upvotes: 2

Related Questions