Compile under Windows using .bat File


#1

hey folks,

im using visual studio code with juce. Under Linux this works great, i just call the makefile made by the Projucer.
Under Windows I have some Problems figuring out what needs to be compiled and stuff…

I have a .bat File that looks like this:

@echo off
call “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat” x64
set compilerflags=/Od /Zi /EHsc
set linkerflags=/OUT:hello.exe
cl.exe %compilerflags% Source/MainComponent.cpp /link %linkerflags%

of course i Need more then MainComponent to be compiled, where can i get a list of all the files that need to be compiled the easiest way?
And if I compiled this, how can i include objetcs so that its not compiling stuff all the time?

Greetz equinox


#2

I know this doesn’t answer your question directly, but why don’t you just use Visual Studio Community (or whatever version your company provides) with the built-in Projucer exporter? That’s how JUCE Windows compilation is generally designed to work, either that or exporting a makefile target for use with MinGW (I think) instead of CLI batch file trickery.


#3

cl is the compiler driver, roughly equivalent to g++ or clang on Linux.

To build a visual studio project on the command-line, use msbuild. A basic invocation would be:

msbuild project.sln /p:configuration=debug /p:platform=x64

#4

Not related to the original question, but this set statement will not give the expected result because of the spaces in the assigned value.

In .BAT, you have to use quotes to assign values with spaces, and the quotes should surround the whole assignment (peculiar, I know, but that’s it):

set "compilerflags=/Od /Zi /EHsc"


#5

yeah this seems to be cool! thx!

P.S.: Im using VS Code because I can also use it on Linux and then I have one workflow on both OS … :slight_smile:

greetz equinox


#6

Slightly off topic, but have you been able to get parameter hints to work with VS Code? I’m pulling my hair out trying to get it to work with a JUCE project I have. I’ve tried everything but nothing seem to work. I get auto-complete for method names, but no parameter info.

[edit] restarting Visual Code did the trick :wink:


#7

noo sorry dont get them too :confused:

off off topic:

did you get clang diagnostic to work with juce?

i have this problem:

greeetz


#8

To be honest, I never got around to trying.