In C++11 I have a problematic line, when it’s commented my programs runs perfect. when I uncomment it it causes tons of errors. My line is: jobs.insert(std::lower_bound(jobs.begin(), jobs.end(), job), job); In the following function: void JobsList::addJob(Command *cmd, bool isStopped) { JobEntry tmp{}; tmp.pid = 0; //getLastJob(&tmp.jid); ++tmp.jid; tmp.stopped = isStopped; tmp.cmd = cmd->cmd; time(&tmp.in_time); for ..
Category : linker
I have a DLL I was handed down by a device manufacturer. I can effortlessly call all its functions from a MS Console application (not from Qt or C++ Builder) but not from an MFC/WinAPI application? In an effort to work around the problem, I’m exploring the LoadLibrary() route. I am experimenting with this code, ..

I am writing a queue implentation in visual studio 2019. I have created two classes Node and Queue. Node class consist of two files Node.h and Node.cpp, Node.h contains only class declarations and Node.cpp contains the defination of declarations. Same for Queue class as well. When i execute the code from main.cpp file, it produces ..
Note: this didn’t solve my problem as I can’t initialise a stack in C++ (as I know): Undefined reference to static variable c++ In C++ I wrote: class ChangeDirCommand : public BuiltInCommand { static std::stack<char*> dir; public: ChangeDirCommand(const char* cmd_line); virtual ~ChangeDirCommand() {} void execute() override; }; and had the following implementation: void ChangeDirCommand::execute() { ..
tl;dr Is there a certain way to link libraries to ensure that thread_local variables are properly defined? I have a class along the lines of engine.h class Engine { private: std::mt19937_64 m_engine; public: Engine() = default; ~Engine() {} std::mt19937_64& get() { return m_engine; } }; and another class that uses it, threadrandom.h #include "engine.h" class ..
No matter what I do I seem to be getting a "undefined reference to dladdr" linking error when compiling the following minimal program (on Ubuntu linux 18.04 with gcc 7.5.0) g++ -o test src/main.cpp -I/opt/netgen/include -L/opt/netgen/lib -lnglib -pthread -ldl #include<iostream> namespace nglib { #include <nglib.h> } int main() { nglib::Ng_Init(); nglib::Ng_Exit(); } I have tried ..
when cpp code Linking on vscode must define json file like below. { "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: g++ 활성 파일 빌드", "command": "/usr/bin/g++", "args": [ "-g", "glad.c", "-pthread", "-o", "main", "main.cpp", "-lglfw", "-lGLU", "-lGL", "-lXrandr", "-lXxf86vm", "-lXinerama", "-lX11", "-lrt", "-ldl", ], "options": { "cwd": "${workspaceFolder}" }, "problemMatcher": [ "$gcc" ], ..
I have a project where I mix C++ and assembly, and most things are fine until I start dealing with linker shenanigans. I implemented a stack tracing method, and I developed a function to walk a compile-time-generated symtab table. The compile time generated symbols only include T-type symbols (in .text section and global). However, I ..
I got the error undefined reference to `memset’ while linking, it compiled fine. I googled the error but nothing helped. The function has a declaration and I really have no idea what the problem is. I’m on manjaro linux using gcc linker command: ld -T kernel.ld -static -Bsymbolic -nostdlib -o bin/kernel.elf lib/kernel.o lib/MemoryManagement/Bitmap.o lib/MemoryManagement/efiMemory.o lib/MemoryManagement/MemHandler.o ..
I recently downloaded vs code in my m1 mac after downloading the g++ compiler in the terminal and then I downloaded the extensions C/C++ IntelliSence and Code Runner. After doing that I wrote a simple Hello World program but it threw me an error. Code: #include<iostream> using namespace std; void main() { cout<<"Hello World"; } ..
Recent Comments