Error: "project.xml" is an unknown target?

Hello,

I’m using FlashDevelop 5.0.0.2 as my IDE and whenever I create a new OpenFL project an error message in red is displayed in the output panel - Error: “project.xml” is an unknown target. I’ve pasted the entire message into Google, but so far I haven’t found anything that helps me resolve the issue.

Here is the contents of the xml file:

<?xml version="1.0" encoding="utf-8"?>
<project>
    <!-- NMML reference: https://gist.github.com/1763850 -->
    
    <!-- metadata, make sure 'package' is at least 3 segments (ie. com.mycompany.myproject) -->
    <meta title="OpenFLProjectTest123" package="OpenFLProjectTest123" version="1.0.0" company="author_name" />
    
    <!-- output -->
    <app main="Main" file="OpenFLProjectTest123" path="bin" />
    
    <window background="#000000" fps="60" />
    <window width="800" height="480" unless="mobile" />
    <window orientation="landscape" vsync="false" antialiasing="0" if="cpp" />
    
    <!-- classpath, haxe libs -->
    <source path="src" />
    <haxelib name="openfl" />
    <haxelib name="actuate" />
    
    <!-- assets -->
    <icon path="assets/openfl.svg" />
    <assets path="assets/img" rename="img" />
    
    <!-- optimize output
    <haxeflag name="-dce full" /> -->
    
</project> 

Even though I get the unknown target error I am able to build a windows .exe, but when I do I see a lot of filenames ending in .CPP scrolling by and the process seems to take longer than I expect it to, but perhaps that is just how it is? At the commandline I have used the following haxelib upgrade all to check the following:

Checking actuate
Checking box2d
Checking flixel
Checking flixel-addons
Checking flixel-demos
Checking flixel-templates
Checking flixel-tools
Checking flixel-ui
Checking hxcpp
Checking hxcs
Checking layout
Checking lime
Checking lime-samples
Checking lime-tools
Checking openfl
Checking openfl-samples
Checking swf

and it finishes by telling me that All libraries are up-to-date

Maybe I am overlooking something?

Looking forward to some helpful feedback.

Thanks.

This usually happens to me when FlashDevelop starts up initially. Adding a character and then deleting it (prompting another refresh) seems to fix it for me. As for the CPP compilation, it really does take a long time during the initial compilation. For the succeeding builds, hxcpp will only compile the files that have changed.

Yeah, C++ takes a long time to compile the first time. After that it should be a lot quicker.

However, if you change any defines (using the <haxedef /> tag), every single C++ file will be recompiled. Just something to watch out for.

Thanks for the feedback, folks.

I’m working my way through the Pong tutorial over on HaxeCoder.com at the moment and so far I haven’t run into any problems as such. The ompilation is a LOT faster after the initial compile is done alright. The syntax is a little strange to me in places as I am used to C#.

Damn it…spoke too soon, I just added the following function to my Pong code and the error it was giving me was Missing return cpp.Void, I removed the :Void bit and it compiled OK, but now I’m not sure how to proceed. Link to the tutorial I’m working through - HaxeCoder.com Pong Tutorial

private function updateScore():Void
    {
        
        scoreField.text = scorePlayer + ":" + scoreAI;
        
    }

The function doesn’t return anything so what is the problem? Is the tutorial out of date and not fully compatible with a newer version of the language? I’m probably overlooking something.

The function looks good to me, but check your import statements for anything weird.

Like player_03 says, check your import statements. If you see an import cpp.Void then delete it.

Thanks for your help, guys.

my imports were:

import cpp.Void;
import flash.display.Sprite;
import flash.events.Event;
import flash.Lib;

import openfl.events.KeyboardEvent;
import openfl.text.TextField;
import openfl.text.TextFormat;
import openfl.text.TextFormatAlign;

Removing the cpp.Void import solved the problem, flash develop had added it automaticaly when I wrote the function and I hadn’t spotted it. What is the conflict between between what is defined in the import and my function?

Void means nothing, no need for a return in that case,
cpp.Void isn’t nothing, you need to return it in that case.

Since cpp.Void shadows Void you get this error.

Thanks, ibilon.

I’m not very familar with C++. What is cpp.Void? What would my function look like if I were returning it?

In the function I’ve tried return;, return 0;, return void(); - none of them works.

What is meant by cpp.Void shadows void?

This, apparently. Maybe “void” in C++ is different from “Void” in Haxe, and this gives you a way to choose between them? Still not sure how you’d use it or why you’d want to.

Personally, I’d suggest adding @:noCompletion in front of the declaration. That way, FlashDevelop will be less likely to import it.

Once you import cpp.Void, you can’t access Void anymore. The compiler always assumes that you’re talking about the one you imported.

In other words, Void is now “in the shadow of” cpp.Void.