Hi,
I am using Windows 10 and the TDM-GCC compiler to compile the code. Recently, I attempted to use the PCANBasic API in C++ and encountered several errors. The drivers are correctly installed and updated, and I'm trying to compile using `g++ main.cpp -o main.o`, but I'm receiving the following error:
```
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\aniol\AppData\Local\Temp\1\cc7Q9LYj.o:main.cpp:(.text+0x63): undefined reference to `CAN_LookUpChannel'
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\aniol\AppData\Local\Temp\1\cc7Q9LYj.o:main.cpp:(.text+0x8b): undefined reference to `CAN_GetErrorText'
collect2.exe: error: ld returned 1 exit status.
```
I will attach the code to provide more information about the error. Interestingly, when I attempt to call the functions from the PCANBasic header, the Visual Studio Code interface recognizes them and shows me the proper information about the functions (this will be attached as well).
undefined reference to `CAN_LookUpChanel'
undefined reference to `CAN_LookUpChanel'
- Attachments
-
- image.png (448.28 KiB) Viewed 1621 times
-
- main.cpp
- (816 Bytes) Downloaded 267 times
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: undefined reference to `CAN_LookUpChanel'
We already answer you in detail that this is a programming skill problem and have nothing to do with our APIs / DLLs.
You need to understand how a DLL and the needed LIB for different compilers / linker work.
We close this post now and maybe will delete it later on...douple posting / sending e-mail with the same question do not make any sense...
For all the rest who are interested what this users "problem" is - google for gcc dlltool and gendef
"with gendef and dlltool, both part of any MinGW-w64 distribution, you can now quite easily generate GCC import libraries from any DLL"
This Tools simply parse the included header and show the the inside the header stored text information when type this function into the Editor...This have absolutely nothing to do that the compiler know anything about this functionality ...it is a VSCode Tool...
* we also moved the Topic to the correct Section *
You need to understand how a DLL and the needed LIB for different compilers / linker work.
We close this post now and maybe will delete it later on...douple posting / sending e-mail with the same question do not make any sense...
For all the rest who are interested what this users "problem" is - google for gcc dlltool and gendef
"with gendef and dlltool, both part of any MinGW-w64 distribution, you can now quite easily generate GCC import libraries from any DLL"
The Visual Studio Code is a EDITOR ! nor more not less ! could be extend by several tools also Syntax Highlighter like IntelliSenseInterestingly, when I attempt to call the functions from the PCANBasic header, the Visual Studio Code interface recognizes them and shows me the proper information about the functions (this will be attached as well).
This Tools simply parse the included header and show the the inside the header stored text information when type this function into the Editor...This have absolutely nothing to do that the compiler know anything about this functionality ...it is a VSCode Tool...
* we also moved the Topic to the correct Section *
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------