Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with multiple independently compiled files when included (redefinition error) #34

Open
DatanoiseTV opened this issue Sep 25, 2020 · 1 comment

Comments

@DatanoiseTV
Copy link

DatanoiseTV commented Sep 25, 2020

My build script for PlatformIO is compiling my used .vult "modules" independently and if another function uses Util. for example, I get a compiler error from the C++ compiler about redefinition of the Utility functions.

I've tried with "-tables false" for all but the first vult file, but that doesn't fix the issue.

vultc -ccode -i vultinc/phase -i vultinc/util vultsrc/{INFILE} -o gen_{INFILE}

In file included from lib/vultgen/vultgen.h:5:0,
                 from src/main.cpp:2:
lib/vultgen/gen_blit_vult.h:254:21: note: 'float Util_cvTokHz(float)' previously defined here
 static_inline float Util_cvTokHz(float cv){
                     ^

How do I deal with it?

@DatanoiseTV DatanoiseTV changed the title Problem with multiple independently compiled files when included Problem with multiple independently compiled files when included (redefinition error) Sep 25, 2020
@modlfo
Copy link
Collaborator

modlfo commented Sep 25, 2020

The way the compiler is architected is that rather than compiling/generating single files, a file and all it's dependencies are amalgamated into single file (or group of files, output.cpp and output.h). Rather than compiling each file separately, you have to compile the Vult files you use in your project at the same time. For example:

$ vultc synth1.vult synth2.vult -ccode

That will generate code for the synth1.vult and synth2.vult files including their dependencies. If both files use a third file called util.vult you will get the code for it as well with a single definition. Currently there's no way of generating the code for a single file. I didn't implemented it that way because I found it more convenient, when embedding the code in a project, to have a minimal set of files to compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants