4coder»Forums
53 posts
How to use setup_new_project command?
Edited by longtran2904 on Reason: Initial post
I don't know how to use the setup_new_project command. What arguments should I pass into it?
Simon Anciaux
1056 posts
How to use setup_new_project command?
You can have a look at 4coder_project_commands.cpp to see what it does and require.

- You need the hot directory to be in the folder where you want to setup the project (for example use the open dialogue to create a directory or open a file in the desired directory).
- Than call the command, it will ask you for:
-- The build target: the source file to compile (e.g. main.c). The build script assume a single translation unit (unity build);
-- The output directory: where to put the resulting executable;
-- The binary output: the name of the resulting executable.

With that the command will create default build scripts (with information from config.4coder), and a project file. You can edit those to better fit your needs.
53 posts
How to use setup_new_project command?
Edited by longtran2904 on
I tried to pass in:
- build target: LongLib_Windows.c
- output directory: build
- binary output: LongLib_Windows.exe
But it keeps send me this error:
Project errors:
D:/Documents/Projects/LongLib/project.4coder:35:12: expected an r-value; r-value formats:
constants (true, false, integers, hexadecimal integers, strings, characters)
any l-value that is set in the file
compound: '{ compound-element, compound-element, compound-element ...}'
a compound-element is an r-value, and can have a layout specifier
compound-element with layout specifier: .name = r-value, .integer = r-value
D:/Documents/Projects/LongLib/project.4coder:36:1: expected an l-value; l-value formats: 'identifier', 'identifier[#]'
D:/Documents/Projects/LongLib/project.4coder:37:1: expected an l-value; l-value formats: 'identifier', 'identifier[#]'
Simon Anciaux
1056 posts
How to use setup_new_project command?
Sorry I was testing on an older version that was using version 1 of the project system.

I have the same result as you describe, so there is something wrong. After looking at the generated project file, there is an error where semicolon are used instead of comas. There is already an issue on github setup_new_project generates incorrect syntax that also raises other issues, so have a look at that.

Near the end, you can change

1
2
3
4
fkey_command = {
.F1 = "run";
.F2 = "run";
};


to

1
2
3
4
fkey_command = {
.F1 = "build",
.F2 = "run",
};
53 posts
How to use setup_new_project command?
Yup, it's working now. Thanks! Just another question, is there any way for 4coder to remember the theme and settings (like toggle line) that I'm currently using?
Simon Anciaux
1056 posts
How to use setup_new_project command?
As far as I know there isn't an out of the box way to do that. You can set the theme and settings in config.4coder manually, although there are some weirdness like the theme name must include the theme- which the default value doesn't making it confusing, and use_comment_keywords for which you need to remove the s at the end.

It should be possible to create a custom function to do that, have a look in 4coder_config.cpp.