Linking Question with Wrapper Code

General questions regarding the usage of CodeLite

Linking Question with Wrapper Code

Postby ColleenKobe » Thu May 10, 2018 4:22 pm

Hi! I'm learning how to write wrapper code so that I can call C++ procedures and functions in an executable from a C dll.

I'm following these directions:

https://www.teddy.ch/c++_library_in_c/

Here's what I've done so far.

1. Created a console-only workspace.
2. Created two projects in the workspace. One compiles with gnu gcc, the other with gnu g++. I set the compiler options for both C and C++ to "-g;-O0;-Wall" (without the quotes).
3. Edited the C project's main as described on the page.
4. In the C++ project, created and edited MyClass.cpp, MyClass.h, MyWrapper.cpp, MyWrapper.h, and My_Main_cpp.cpp.

The files all compiled error-free.

My question is about linking. At the bottom of that page, the writer says:

Note that the linking has to be done with the C++ compiler, a C linker like ldd does not work:

g++ MyMain_c.o MyWrapper.o MyClass.o -o MyMain_c


I went to the CodeLite Project Settings/Linker page, and I'm not sure how to set the linker used at ALL. I don't know what the default is. How do I set the linker used to g++ ?

I am using CodeLite v12.0.2, on Windows 10 platform, 64-bit.

Thank you!!

Colleen Kobe
ColleenKobe
CodeLite Veteran
 
Posts: 93
Joined: Wed Mar 30, 2016 4:31 pm

Return to Using CodeLite

Who is online

Users browsing this forum: No registered users and 8 guests

cron