I can't get open62541 to work in visual studio code, c++, windows

37 views
Skip to first unread message

Jesus Zanelli

unread,
Jan 30, 2025, 4:43:10 AM1/30/25
to open62541
Hello, so what am I doing wrong?

1. I install: visual studio 2019, visual studio code 1.96.4, CMake (cmake-gui), Python 3.13 (64-bit), msys2-x86_64.exe (I download MinGW-w64); I update environment variables
2. I download the open62541-1.4.9.zip file from the web, with cmake (using amalgamation and the default compiler) I generate a .sln project, in visual studio I compile and generate an open62541.c and open62541.h; or I download directly the open62541.c and open62541.h files
3. I open visual studio code, create an empty c++ project, create a server.cpp file and copy the code "Building a Simple Server"; inside the folder I copy open62541.c and open62541.h
4. In my project I configure Intellisense Configurations: Compiler arguments > C:/msys64/ucrt64/bin/g++.exe; Intellisense mode > gcc-x64 (legacy)
5. In the server.cpp file I use run, choose "C/C++: g++.exe build and debug active file preLaunchTask: C/C++: g++.exe build active file"; unfortunately I get these errors:

-#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\jesus\Documents\OPC-UA\ejemplo2\server.cpp)
-cannot open source file \"open62541/server.h
-open62541/server.h: No such file or directory

I understand that if successful, a server.exe file should be generated. I want to create a project in Visual Studio Code as "normal as possible", that is, use a library through #include that allows me to use functions and classes. Thank you very much.

Julius Pfrommer

unread,
Feb 5, 2025, 5:43:08 AM2/5/25
to open62541
Hey there,

when you use the "single file release", then you only have the open62541.h.
You then only need that one.
You only get open62541/server.h when you use the "normal sources" instead.

Regards,
Julius
Reply all
Reply to author
Forward
0 new messages