Replies: 2 comments 3 replies
-
Hi @PBaswat |
Beta Was this translation helpful? Give feedback.
-
When I run the code, I don't get the issue with the PIC ❯ clang++ *.o
/usr/bin/ld: myprogram.o:(.rodata+0x60): multiple definition of `__myfunctionblock__init'; functionblock.o:(.rodata+0x0): first defined here
/usr/bin/ld: print_string.o:(.rodata+0x0): multiple definition of `__print_string__init'; myprogram.o:(.rodata+0x0): first defined here
clang-14: error: linker command failed with exit code 1 (use -v to see invocation) But that is still an issue if because it makes using the compiler harder. We usually default to PIC (or at least we started to default to pic when we implemented the parallel compilation). Maybe you had an older .o file that was compiled with the previous version? {
"name": "Test",
"files" : [
"*.st"
],
"compile_type" : "Object"
} Run the compilation with : rusty/target/test on master [$?]
❯ clang++ main.cpp build/Test.o -o Test
rusty/target/test on master [$?]
❯ ./Test
CI : 1, PRINTER : 0, IN : : result |
Beta Was this translation helpful? Give feedback.
-
Hi,
i am working on project in which i need to call program from c++ main function, and inside program i am calling function block which will internally calling one function. and i am printing result inside program.
Here i want to compile individual ST file separately and then link together with c++ main program, but i am getting some linker error.
------------------------------------------------------------File : main.cpp------------------------------------------------------------
------------------------------------------------------------File : myprogram.st------------------------------------------------------------
------------------------------------------------------------File : myfunctionblock.st--------------------------------------------------------
------------------------------------------------------------File : myfunction.st--------------------------------------------------------
------------------------------------------------------------File : print_string.st--------------------------------------------------------
List of commands To Build Individual ST sources are mentioned below,
plc -c print_string.st -o print_string.o
plc -c myfunction.st -o myfunction.o
plc -i myfunction.st -i myglobalvars.st -c myfunctionblock.st -o myfunctionblock.o
plc -i print_string.st -i myglobalvars.st -i myfunctionblock.st -c myprogram.st -o myprogram.o
clang++ -c main.cpp -o main.o
clang++ main.o myprogram.o myfunctionblock.o print_string.o -o Test
Error Received During Compilation Are:
Beta Was this translation helpful? Give feedback.
All reactions