Undefined Symbol from custom .fx


I get “Undefined Symbol” when i use code from a successfully imported and recently created .fx file by the Headerimporter (the actual .h file is 100KB, the .fx file is 117 KB so it should have worked fine I guess…)

consider this code:

  class method Main(args: array of String): Int32;
      raylib.BeginDrawing();  //----call from .fx
      var bla, bla2 : TRecord;
      bla := bla2;  
      raylib.EndDrawing();   //----call from .fx


Pls watch the zip attached, to gather all you need in order to understand whether I have done smth wrong or if it may be a linker error:
HeaderImporter stuff.zip (2.7 MB)

Happy Christmas to you all!


PS: i updated the attached zip, it contains all you need now to reproduce and investigate

CUrrent version: Stable ->
Windows 10 latest update 64bit

  • use Import Projects
  • set the Codegen option for the project to, say, Oxygene to get a .pas file where toucan see what was imported and under what names. Makes it easy to pick out what might have gone wrong. (note, the pas is just for reference, it’s not used)

I assume this comes from the linker, not the compiler, which means that the import was actually successful, and the .fx has the types and members you need, which is why your code compiled. But at link time, the linker is not getting a binary that contains the compiled code.

a .h is just the description the interface of a library, you still need the implementation — this could be .dll or .lib on Windows, a .dylib or .a on macOS. (it could also be a .c file, in which case you’d still have tom compile that using a C compiler, yourself ;). Specify that binary in the “ImportLinkLibraries” project setting of the Import project. if it’s a dynamic library (.dll, .dyib), also set CopyLocal for it to true.

tbh marc, I have read the “Import Projects” docu twice and just cant get my head around how to create such project, I mean I copied the sample code, but how can I specify these different Settings like the “ImportLinkLibraries” shall I add this in here?

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> <OutputType>Import</OutputType> <SDK>Windows</SDK> </PropertyGroup> <Import Project="$(MSBuildExtensionsPath)\RemObjects Software\Elements\RemObjects.Elements.Toffee.targets" /> </Project>

Since I have also access to “raylib.dll” and “raylib.lib” what would u prefer is the most easiest way to bring them to the linker, and how shall I create an “Import Project” out of the above mentioned? Sry im abit confused regarding this topic right now. And where must this .xml file resist in order for the ElementsLinker to find it?

Ok I found the “Import Project” from Water, and I have done actually everything what is needed, in order to provide Water/Elements with the necessary data and when compiling it builds correctly the “Import Project” and “the actual water” project, now i added the “ImportProject.fx” to the project settings (where the island.fx and gc.fx remain) and he even recognized raylib aswell, (i deleted the raylib.fx before!) but sadly, I got still “Undefined symbol” :frowning:

He says, “raylib.lib” doesnt exist: here my settings panel:

I removed the “copylocal” flag from the “raylib.lib” binary and now he recognizes raylib.lib (he doesnt output raylib doesnt exist in the debug panel while he is building) butt still same undefined symbols

There’s a template.

Can I see the complete project, including all input files, such as the .h and .lib and the project that tries to use this?

hey Marc, here it is:

ConsoleApplication.zip (2.0 MB)

sry that was the wrong one! take this here it includes the raylib.h and raylib.libConsoleApplication.zip (4.1 MB)

I had to fix the paths in your project to match the local zip, but after that, your project compiles clean for me.

(Note, also fixed the hardcoded reference to the import project to be a project reference, so that Elements knows to build them ion the right order):


    <Reference Include="ImportProject">


    <ProjectReference Include="ImportProject">

the way to do that is to delete the existing reference, and then drag the Import project itself up onto the Console app tom re-create int as project reference. (this has no effect on it working it’s just neater).

I do get the hint “File ‘raylib.lib’ does not exist.” from the linker (I’ll investigate; Oddly, I don’t see raylib.lib being passed to the linker at all), but i get no linker error for missing symbols, but im also not sure isn your code actually uses it?.. (I can’t test if the app works, as I’m on macOS right now).

Here is my adjusted project; all paths relative, and with project reference.

ConsoleApplication 2.zip (4.0 MB)

Got it, my bad: you always have too set copy local on the binary, even for a .lib.

first of all thanks for the work until now, sadly tho I have to disapoint you , I have exactly downloaded the attached project from you, changed the .lib from "copylocal(unchecked) to copylocal(ckecked), (right click on raylib.lib) and then added a raylib.function which still says, undefined symbol :frowning:

I mean he doesnt say anymore raylib.lib doesnt exist but i have no idea why he fails, can it be (i highly doubt that, since other ppl are using the new github repo from raylib 3.5 well tested C library) that the lib is broken?

Can you be more precise and give me the full error? Also, did you change the code, since what you sent me, to actually USE types from the lib? If so, can I see it?

As I said, i took your .zip, uncommented the raylib code, so i make use of it, then i made a copylocal =true of the .lib via right click, and i get this linker error

and yea it also has the option active: “ImportLinkLibrary”

class method Main(args: array of String): Int32;

    var bla : TRecord;
    var ctorRec := new TRecord(bla);
    bla.A := 100;
    bla.B := Char(100);

    writeLn(bla + bla2);
   // raylib.EndDrawing;

Well, that’s the info I was missing; I’m it good at reading minds for what changes to a test case need to be made to reproduce the error.

This could be a mangling issue, or an actual problem with the .lib not matching the .h. I assume IsAudioDeviceReady does show in the reference code file generated by the .fix!

I can check when I’m back at the computer later; but we’re on skeleton support between Christmas and the new year; see the top pinned post.

FWIW, that is not the same code I have, the code here has no mention of IsAudioDeviceReady. that said, I can reproduce the error. bout the linker not seeing the two methods you do call.

I’ll have to pass this on to the compiler team (which means, next week). i’m expecting its either a name mangling issue (what compiler was used to build the .lib, and what settings?) or a bad .lib that actually doesn’t have those members (maybe there’s more than one lib?)


Thanks, logged as bugs://85360

Seems that accordion to DUMPLIB, the exports don’t have underscores. This is beyond my pay grade, but I think that might be to do a wrong option on the C compiler, or an incompatible C compiler… The compiler team will know more, next week, sorry — this is all I can check for now.

all good marc, i only wanted to know for know, if its an error i have casued, or rayylib or indeed the lijnker/compiler. thx for that, have a blessed week !

1 Like