4coder»Forums
6 posts
Beginner C user, please help with customization
Edited by Bouke285 on
Hi,

My background is in C# and higher level languages. I'm very interested in getting familiar with building my code outside of visual studio. I want to start messing around with making some customizations in 4coder. Could someone point me to a location that goes over the process for someone entirely new? How to create customizations from ground 0 in 4coder (at least how to get the file building).

I have the buildsuper.bat compiling cpp files, but let's say I create an empty cpp file to hold my customization, what do I need to include to make it build and use the 4coder API? Thanks!

I've been trying to settle on an editor to learn, so I want to get my feet wet with 4coder as I gain more experience with C/C++


*EDIT
1) I found the "4coder_default_include", but the build bat has the WX flag set for compilation; I'm getting a few warnings in the default_framework.h file, is it safe to remove the WX flag so my file can build? Or is there a better way to handle this?

2) I'm also getting this linking error "LINK : error LNK2001: unresolved external symbol get_bindings
custom_4coder.lib : fatal error LNK1120: 1 unresolved externals'"
Simon Anciaux
1337 posts
Beginner C user, please help with customization
Have a look at 4coder_default_bindings.cpp, it's the file that gets compiled by default for the custom layer. I suggest you to make a copy of that file to do your custom layer to avoid overwriting it when you update to a new version.

You can compile your file using buildsuper.bat by passing its name as the first argument in a terminal.
1
buildsuper.bat custom_layer.cpp


You can create a new command (function) like this:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
CUSTOM_COMMAND_SIG( command_name_here ) {
    // command code here.
}

CUSTOM_COMMAND_SIG( other_command_name_here ) {
    // command code here.
}

void default_keys(Bind_Helper *context){

    begin_map(context, mapid_global);
    ...
    bind(context, 'a', MDFR_CTRL, command_name_here);
    ...
    end_map(context);

    // Those bind only work in code files.
    begin_map(context, default_code_map);
    ...
    bind(context, 'b', MDFR_CTRL|MDFR_ALT, other_command_name_here);
    ...
    end_map(context);
}


You can find some tutorials and the API documentation on the 4coder website.
Apart from that you can search the source files in the 4coder directory to find out how to do things, or copy some of the functions and modify them to better suit your needs. For example 4coder_default_hooks.cpp contains the default function that get called when something happens (opening/closing a file, detecting if a file is code...). Note that if you change hooks you should modify get_bindings to set up your hooks (see set_all_default_hooks to know how to do that).

For your questions:

1. It depends on the warning you have. If you didn't modify the file, you can signal the exact warning and the version of visual studio you use to Mr4thDimention by e-mail. You can probably disable WX until it is fixed (or fix the problem on your side).

2. get_bindings is the function that will be used to "start" your custom layer, you must have it in one of the file of your custom layer.
6 posts
Beginner C user, please help with customization
Perfect, thank you!