Include Header files in Eclipse [message #1839122] |
Mon, 15 March 2021 02:44  |
Eclipse User |
|
|
|
So first of all, I'm completely new to Eclipse , I have learned C++ for about 5 months now and this is probably some basic stuff for y'all.
I use Eclipse IDE for C/C++ Developers - Version 2020-12 (4.18.0) on a MacBook Pro - macOS Big Sur - Version 11.2.1.
First: For my study I have to include two header files to my eclipse. "CImg.h" and "Drawing.h" and I should link a Drawing.cpp file as well. How do i do this?
Second: I should also add the files "pthread" and "X11".
I have instructions (I put them at the end for you) for Linux but when I follow them step by step it doesn't work on my Mac.
There are loads of errors appearing but in the line of #inlcude "Drawing.h" it says "unresolved inclusion" so where do I have to do something else?
I would really appreciate your help as I need this to get started!
These are the instructions that should work on Linux:
"Project -> Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C++ -> Include directories -> Add" choose the installation paths of "CImg.h" and "Drawing.h"
"Project -> Properties -> C/C++ General -> Paths and Symbols -> Libraries -> Add" add the file "pthread" and "X11" (just type the name)
|
|
|
|
|
|
|
|
Re: Include Header files in Eclipse [message #1861031 is a reply to message #1861004] |
Thu, 14 September 2023 15:37   |
Eclipse User |
|
|
|
Hi, do you know how to add a shared library on windows 10 in eclipse for C?
Here's what I've tried to do:
On Windows 10, using eclipse for c projects I have installed the MinGW compiler. I've been able to add a static library (*.h, *.c files). I can't for some reason get a shared library to work.
I notice that for my shared library I generate a *.o file and a *.dll file but I am not creating a *.so file.
Here are the steps I'm taking:
1) open eclipse in new workspace
2) create a new c project
a) project name ->SharedLib
b) project type -> shared Library -> empty project
c) toolchain -> MinGW GCC
3) In SharedLib folder
a) create test.h (header file) and test.c (source file)
test.h
#ifndef TEST_H_
#define TEST_H_
void test_print(void);
#endif /* TEST_H_ */
test.c
#include <stdio.h>
void test_print(void){
printf("we have lift off");
}
4) build Sharedlib
a) creates Binaries -> libSharedLib.dll
5) create new c project Exec
a) empty project
b) add source file main.c
main.c
#include <stdio.h>
#include "test.h"
int main(void){
printf("we are on the launch pad");
test_print();
}
6) go into properties of Exec->Paths and Symbols->references
a) choose SharedLib, apply and close
7) build all and then run
I have no error messages and no output. the only thing it says is:
<terminated>(exit value: -1,073,741,515)Exec.exe[C/C++ Application]
D:\workplace3\Exec\Debug\Exec.exe(9/14/23,3:05pm)
Could really use some help getting this to work.
The goal is to get this shared library automatically included in all my c projects
[Updated on: Thu, 14 September 2023 15:57] by Moderator
|
|
|
Re: Include Header files in Eclipse [message #1861051 is a reply to message #1861031] |
Fri, 15 September 2023 14:22  |
Eclipse User |
|
|
|
This is actually an off-topic for Eclipse, it is about installing a shared library for use with MinGW.
A MinGW forum may be better for a discussion.
Sorry, I do not have a working Windows installation to check. Last one was a XP not more activated.
My guess is that you have to introduce the DLL to Windows.
|
|
|
Powered by
FUDForum. Page generated in 0.02957 seconds