I've been instructed to download and install FlashDevelop and it seems fine but I don't know how to generate exe files when writing programs in Haxe. I try to Build or Run the project in FlashDevelop BUT it just doesn't do anything. Can anybody please advise me on how to do this?
Thank you
The CPP target is the youngest in the Haxe world and so still a little rough on the edges; add in more complexity because it depends on external tools to properly work.
Made that premise, try to create a new Haxe/CPP project in FlashDevelop, open the Main class and add a simple trace("hello world!"); line. Hit F5 to start the "compile and run" process.
You'll see in the status bar the message "Build started ..." and you can follow the process looking at the "Output Panel". If your environment is set correctly it will compile the whole project and open a DOS window where it will execute the generated executable (you can find it in the bin folder).
If you receive an error then your environment is not yet ready to build CPP applications with Haxe. To fix that follow the setup instructions you can find here.
An easy alternative to produce native execubles (yes, you can compile the same for Win/Mac/Linux) you can target neko to produce a .n file and nekotools to transform it in the exe form. Just type:
nekotools boot main.n
Related
Basically, I have a Visual Studio project that builds a DLL (a VST audio plugin). Where this type of project scenario has been set up for me in the past, I would be able to build, run, and debug the plugin. Visual studio would automatically launch whichever program I was using to host the plugin. I am trying to achieve the same effect in my current project, but I don't know how to set that up. Currently when I build and run my DLL in Visual Studio, I get the error "Unable to start program". The DLL still builds, and I can still run it, but I can't debug it from Visual Studio, because I don't know what I need to do in my project settings to make this happen. How can I do this?
MORE INFO:
What I do know is that, in projects where this sucessfully works, there are some modifications made to the Visual Studio project settings under fields marked 'pre-build events' and 'post-build events', so presumably what I want to do is edit these in some way to tell Visual Studio the following: "Hey, before you try and run and debug this DLL, you have to launch another program (my program is called Max.exe), and then you have to wait until that program loads the DLL. Then you can debug! Don't be a stupid computer and try to debug it before it's even loaded in Max.exe..."
What I do not know : EVERYTHING ELSE. This is literally all I know about what I'm trying to do, hense the colourful attempt to talk to a computer in English.
Currently when I build and run my DLL in Visual Studio, I get the error "Unable to start program". This is unsurprising seeing as the project knows nothing about the environment I want to use to test the DLL, but the problem is that I don't have a clue what Visual Studio needs to know. I really don't know enough about programming to understand the implications of what I'm trying to do either. Yes, I did mention those fields marked pre-build and post-build because I remember them being important, but I don't know exactly what or how to write in those fields, and I also do not know if there will be more things I need to tell Visual Studio before this will work.
Q.E.D I'm not actually sure what pre and post build events are, or how they work. And I barely know the first thing about customizing VS project settings. All I know is how to write audio processing code. I felt the need for this disclaimer because typically my questions are met with angry programmers who think I don't do my own research; they fail to realize I am an audio engineer who skipped programming 101. Yes, how to debug a dll is a common question I'm sure, but answers to those questions tend to assume pre-requisite knowledge that I do not have.
You will want to edit the Command field in your project's Debugging properties. Right-click on your project in the solution explorer and click Properties (it's generally the last item). Open the Debugging page under Configuration Properties. The Command field indicates which executable to launch when debugging.
By default this contains $(TargetPath) which refers to the final binary your project compiles. This is useless for DLLs since DLLs are not executable. Change this to the path of whatever third party application you are writing a plugin for.
With this change, launching with debugging will actually launch the third party application and attach the debugger to it. Once the application loads your plugin, you will be able to debug it normally.
For Visual Studio,
In Solution Explorer, right click on project and select Properties.
In Properties, choose Configuration Properties -> Debugging.
For Command, enter the full path of the executable that will be loading your DLL. Fill in the Command Arguments and Working Directory accordingly.
In addition, you need to make sure that the executable actually loads the DLL you are building. A mistake that a lot make is to launch their executable, and not realize the executable is loading another version of the DLL they are trying to debug. This can happen due to Windows searching for the first DLL that it finds using the DLL searching logic (exe directory, path, etc.).
I am somewhat of a beginner when it comes to open source libraries. I have tried to compile from source and use the pre-built binaries, but in both cases I get a ton of errors when I try to run the simple 'Hello World' program on the tutorial section of the wxWidgets website. After playing around for quite some time, the closest I have got to compiling is by building the libraries from source, but I still have 2 errors remaining:
"_w64 can only be specified on int, long, and pointer types" file: defs.h
"cannot open file 'wxbase31ud.lib" - LINK
It seems strange to me that the header file provided by wx would have an error such as that one, so I imagine both errors are because of something I am doing. I am hoping that someone here can do one of the following for me:
Help me solve these errors
Provide instructions for building libraries from source and subsequently linking my program to the correct directories
Some additional info: I am working on x64 Windows 7, my target will also be x64 exclusively. I do not have admin privileges, so no editing the system PATH for me.
Thanks for your help!
The simplest way to start working with the library is this:
Grab the sources.
Unpack the sources.
Open VS IDE.
Open \build\msw\wx-vc14.sln (adjust as necessary.)
Go to "Build->Batch Build...", click "Select All", "Build".
Go drink some coffee or watch TV.
After the build finishes, open wxWidgets/samples/minimal/minimal_vc9.sln.
Let MSVC convert the solution to become an appropriate format.
Build and run the sample.
If you will acquire any issue during those steps, let us know.
The library build in step 5 should build without any issues and then all you will need is to build the minimal sample.
The next step is to copy the samples\minimal folder somewhere and start writing the code. All you will need to do is to change the Include and Lib search path.
[EDIT]
If you can build the 32-bit libraries (which are default in the provided solutions) all you will need is to convert them to be 64-bit and rebuild.
There is no changes to the $PATH or any environmental variable involved. Moreover you shouldn't build anything with the admin priviledges.
Also as Thomas pointed out you library build has to match whatever sample you are trying to build.
[/EDIT]
I'm learning c++ and I'm building simple, procedural programs that only consist of the one file (where int main() is located). I find it fairly tedious to create a new project in Xcode for each file and I was wondering whether there's a way to either have multiple files in a project and choose which one to compile, or a faster way to create and run/build C++ files in Xcode. I'm currently just commenting programs out as I go and I'd appreciate someone suggesting a better way. I'm open to using Sublime and Command line as well
You can choose which files to build and run by changing the Scheme.
I am assuming that you are creating a Console Application / target for each set of files you want to run separately.
go to Product->Scheme and change the Scheme.
Then Build and Run your files.
I think command line is the way to go here. You can easily edit the files in XCode (open -a Xcode file.cpp) and compile and run it from the terminal (clang++ -std=c++11 -stdlib=libc++ -o name_of_executable file.cpp).
An alternative to having multiple targets in XCode is to have one command line target and change the file that you compile as a part of the target. In XCode 5 you can show the Utilities panel (top right icon - Hide or show the utilities) and check/uncheck whether a selected file belongs into a target (in the window titled Target Membership). That way you can have a number of files, each having its main() but you always have only one file selected as a part of the target.
You can create a single project file, then create a new target for each new app instead of a new Xcode project. I'm not sure if that meets your needs or not.
Although if all you're doing is compiling and running a single file, why even use Xcode? Just go to the command line and compile and run it directly, if that's easier. You can invoke clang directly. See the man page for details.
Using Visual Studio 2010, coding in C++:
So I've got a solution and two projects: Project 1 is a Windows application meant to act as the GUI for the program, while Project 2 is a console application meant to interact with some external applications.
I want to create a button in Project 1 that when pressed executes Project 2. What's the simplest way to do this? I'm thinking of just running Project 2 through the Command prompt with a "system("Project2.exe");" kind of approach, but I don't know how to reference a project executable instead of an external, already existing executable.
I'm pretty new to C++ and Visual Studio in general so I could be missing something obvious here, sorry. Thanks for your help!
If you want to run another program(even your other project or some unrelated executive that you get from your last traveling to moon) you should now the path of other project in either absolute or relative form or it should be in the path.
So in your system that you know the path, you can hard-code it in your source file, for example system( "C:\\path\\to\\my\\application.exe" ) or system( "..\\project2\\output.exe").
And in another system you have 3 options:
Put your project2.exe in the PATH by either adding its path to the system PATH or copy it into a folder that is already in the path like system folder
By using a setup copy it into a predefined folder( usually relative to project1.exe ), for example in the same folder or ..\\server\\project2.exe
Create a config file that user can put the path of executable of project2.exe in it
can you change project 2 to build as a class library, so you can just use that dll in your project 1?
I think what Mike said is the better way but I guess you'll encounter the same problem here. You have to define "Project Dependencies". Right click on project 1 -> Project Dependencies -> Select project 2. Now Project 2 gets compiled before project 1. (You have to do the same for libs if you decide to go that way).
If you want to move a file after compiling it you can define a post-build event in your properties. (Configuration Properties -> Build Events -> Post-Build Event) There you can copy a file by defining for example a command like xcopy /y "$(ProjectDir)Release/myexe.exe" "Some path"
Other than as mentioned by Mike Corcoran, you can also use any external program if you put it into the system's PATH variable and then have it executed by system(const char *) function
Driving it this way is passable, but its not the correct way. For example, if your program was interactive it would fail instantly or have an UB(undefined behavior). To avoid this, separate the logic of the program from the input/output and work your way around it in your code.
Some successful Linux programs have managed to get the output of the console application and display it on the GUI(having you to interact with it internally). Even Visual Studio does this - the output you see when you compile your applications such as "successful build" etc etc is executed in the command line and then the output of it is redirected.
Good luck.
Using latest MinGW and C++ Eclipse.
If I create an "Executable Hello World" project, build it and run it, everything works as expected.
If I create an "Executable Empty Project", then create a main.cpp file, build and run, I get the error message "Launch failed. Binary not found."
How can I make empty project generate binary files? I looked everywhere in the project properties but I must have missed it.
For me the solution was this:
select your project and goto "project"-menu/properties (on mac).
c/c++ Build/Settings.
Binary parsers. now tick the one that suits your system (elf for linux, mach 64 for mac, pe for windows etc). the default is always elf and it reverts to it after every project, at least for me.
On Eclipse Kepler (c++) with standard settings I today discovered that the error parser that creates the output in the "Problem" tab failed
In the console there was an compile error from gcc, but it didn't show in the Problem tab, which is the one I look in the most. It was a type conversion error, very typical and nothing exotic, definitely something that should be included as an error.
Hope it helps someone.