Closed nturumel closed 5 years ago
i have a static library .a file that I created, I want to add it to another project, what should I do? Currently I copy it to the project and then goto properties, C++ build options and add a library there, in the library path option, however, it gives me a -lC://.... cannot locate sample.a file, even though it is there. Is it a parsing problem?
Hi
There are two ways you can do this in Cevelop. If the library is a separate Cevelop project in the same workspace, you can do the following:
Open the properties of the executable project.
Go to C/C++ General -> Paths and Symbols -> References
Add a reference to the library project. This will automatically set the library path, header path, etc.
The end result should look like this:
If you instead want to add the library and its header files directly to the executable project, you can do that as well. However, this means that you need to manually specify the library path, library name, etc:
Open the properties of the executable project.
Go to C/C++ General -> Paths and Symbols -> Library Paths and add the path to the library as a workspace path.
Go to C/C++ General -> Paths and Symbols -> Libraries and add the name of the library (without the lib prefix and the .a file extension).
I hope this fixes your problem. Otherwise, please let us know.
I tried to do that, but I still have issues, as I mentioned before I need to link the lib.a file in this case libSignalStatisticsLibNihar.a file and the header file to my executable, even if it means to copy both the .hpp and the .a to the executable folder, can you help me with it?
Your build went perfectly. And since it is a static library it will be included in your exe file.
What might be missing is the compiler's run-time library (DLL). Depending if you are using g++ on windows through cygwin or mingw different reasons might be the case. Can you run the exe in a command prompt window. If it is cygwin, does it run in cygwn's bash, if it you are using mingw can you run it in a regular command prompt. You might need to add the compiler's runtime DLL's location to your path. I remember from 10+ years ago, it was recommended for Cygwin users to copy the cygwin DLL into the WINDOWS directory to have it always available.
I think there might be something else, is there a way to use just the header and the archive of the library and hide the implementation?
So, your program linked just fine, but does neither run from Cevelop nor from the command line.
did your test your compiler's installation on your windows computer by itself, e.g. by compiling a simple hello world c++ program with it. if that does run, then there might be something.
However, to further diagnose, I suggest that you provide more information about your windows and g++ setup, because the problem definitely does not seem to be rooted in Cevelopl, but in your underlying compilation/execution setup.
You are using the 32 bit command prompt. May be your program was compiled for 64 bit.
What Windows Version are you using (version, 32 or 64 bit)
What compiler (version) are you using for compilation (cygwin/mingw, 32/64bit, version of g++)?
Can you compile and run a minimal C++ program?
Otherwise, everything is just speculation.
BTW, you should have provided all that information when you initially filed the bug
I am able to compile and run hello.cpp program
On Thu 7 Mar, 2019, 12:05 PM Peter Sommerlad, notifications@github.com wrote:
So, your program linked just fine, but does neither run from Cevelop nor from the command line.
did your test your compiler's installation on your windows computer by itself, e.g. by compiling a simple hello world c++ program with it. if that does run, then there might be something.
However, to further diagnose, I suggest that you provide more information about your windows and g++ setup, because the problem definitely does not seem to be rooted in Cevelopl, but in your underlying compilation/execution setup.
You are using the 32 bit command prompt. May be your program was compiled for 64 bit.
1.
What Windows Version are you using (version, 32 or 64 bit) 2.
What compiler (version) are you using for compilation (cygwin/mingw, 32/64bit, version of g++)? 3.
Can you compile and run a minimal C++ program?
Otherwise, everything is just speculation.
BTW, you should have provided all that information when you initially filed the bug
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Cevelop/Issues/issues/92#issuecomment-470610009, or mute the thread https://github.com/notifications/unsubscribe-auth/Ar1co6DeBCXVBwNdQM1tQxS-W0k5WzuNks5vUUbogaJpZM4bh2ZI .
Sorry, I will provide all the information in the future
On Thu 7 Mar, 2019, 12:07 PM Nihar Turumella, nturumel@andrew.cmu.edu wrote:
I am able to compile and run hello.cpp program
On Thu 7 Mar, 2019, 12:05 PM Peter Sommerlad, notifications@github.com wrote:
So, your program linked just fine, but does neither run from Cevelop nor from the command line.
did your test your compiler's installation on your windows computer by itself, e.g. by compiling a simple hello world c++ program with it. if that does run, then there might be something.
However, to further diagnose, I suggest that you provide more information about your windows and g++ setup, because the problem definitely does not seem to be rooted in Cevelopl, but in your underlying compilation/execution setup.
You are using the 32 bit command prompt. May be your program was compiled for 64 bit.
1.
What Windows Version are you using (version, 32 or 64 bit) 2.
What compiler (version) are you using for compilation (cygwin/mingw, 32/64bit, version of g++)? 3.
Can you compile and run a minimal C++ program?
Otherwise, everything is just speculation.
BTW, you should have provided all that information when you initially filed the bug
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Cevelop/Issues/issues/92#issuecomment-470610009, or mute the thread https://github.com/notifications/unsubscribe-auth/Ar1co6DeBCXVBwNdQM1tQxS-W0k5WzuNks5vUUbogaJpZM4bh2ZI .
can you do that from Cevelop? Or only on the command line? Again, which g++ are you using?
Thank You, I can run a sample file from cevelop, not from my terminal, I am sing mingw 0.6.3, is there any way I can upload my executable project folder and have someone help me please?
The problem you are having is definitely a 32/64 bit problem, if my google foo is not wrong and has nothing to do with Cevelop. If you can not provide the information I asked for, I can not be of further help. I won't debug your executable (which I doubt is the problem). I expect everything you are running is 64bit. But may be the option set in your mingw compilation targets 32 bit and such a program might not run on your system or vice versa.
we usually recommend our students to use https://nuwen.net/mingw.html installation. However, this requires some adjustments (see cevelop FAQ), so that Eclipse CDT detects the compiler. current is Version 6. if your version number is correct it seems very old, it might be just that the .exe generated is not compatible with your windows version.
Thank you for your help, I understand as, I am operating on a 64 bit os, and I am using the mingw 0.6.3, I will take a look at the link you sent me
Expected Behavior
Please tell us what you expected to happen. If possible, include some sample code for us to reproduce what you're seeing.
Actual Behavior
What happened instead? If you have a screenshot or stack trace of the error, please attach it.
Cevelop Version, Operating System and Compiler
The more we know about your setup, the easier it will be for us to reproduce the problem.