-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling on windows using visual Studio #55
Comments
Hello @grazba, the compiling process is as you described but there are some details that might help you:
I noticed that the Makefile includes the core files when building the release version of So although I am not experienced with Visual Studio, I bet you could just include all the files I mentioned when creating the libraries. The reason for creating 2 |
Also there is a difference between a .dll which is a Shared Library and an Object file. I actually never needed to use a Shared Library myself, the The only requirement they might need to work is for the compiler to be compatible with C++11 standard. In GCC this is made by adding a flag to the compiler: -std=c++11 I hope this is helpful, I will be available if you have any other doubts =] |
Thank you for your answers, it helped a lot ! I had an issue with ref-qualifiers (not supported by the compiler we're using). |
Hi again , so i have to reopen this one ^^ ! So i did get it work, but the built in features are not there, i added the builtin-features.cpp file to the project and even added the headers to it as well just for good measure. But for a reason the parser can not recognize the operators , if i declare a variable and send it to the parser to evaluate and print it it works fine. I tried to create another project that uses the first library (the core) and adds the built in features and the results are the same no operators are recognized. the only things i changed in the source code is adding a header file include for the integer types used (it's necessary on windows) and i deleted the && qualifier (not supported by my compiler). It should not change how things work (just some memory waste no big deal) or am i wrong ? thank you again ! |
Yes it should not have changed the behavior. The built-in features are added during static initialization time: On each of the files in class Startup {
Startup() {
// access global variables only once at initialization time.
}
// This name after the class declares an instance of this class (named _Startup)
// at static initialization time making the constructor run only once:
} _Startup; If they are not running it might mean these constructors are not being executed which might have 2 reasons:
In any case you could confirm if it is being executed by adding a If the problem lays in the static initialization order you could replace these Startup classes with a global function that you may call once inside your code. But again this is only if you are initializing static class instances that execute cparse expressions at contruction time, which is an unlikely scenario. If you find out anything new about this problem tell me, I want it solved as well =] |
well i printed something on each of the constructors to see if the code is even executed and apparently it is not.
i'm thinking about including the adding of features into my code that should help me go forward, but it still bugs me that i can't make it a whole static library that i can use directly in another project. |
Check the file It is a little confusing but before this change all the builtin-features were kept in a single file whicih was much more complex to read. |
Also if you look carefully all of them declare instances, except the name the instance use is the same as the class name (this is a way of implementing the singleton pattern, since once this instance exist the class name is not acessible by other parts of the code, only the instance). |
I have made some changes on the builtin-features files to improve its readability:
I am also bugged about why these are not being executed. I am thinking about how to improve this so it won't give you too much trouble to initialize them. I have an idea of how to do it, tonight I will try to implement it, it should greatly simplify setting up the library without static initialization. Hopefully this will solve it for you. |
So as i expected if i add the features in my code it works fine ! i'll look more into it to find a way to get everything as a library (or two keeping the original design) and if i get it working i'll share the solution files for visual studio 2013-2015-2017. looking forward to your changes too , have a good one talk soon. |
Hello @grazba, I was unable to work yesterday night but I just did it. There is now a new file called If you include this file inside your #include "cparse/builtin-features.inc"
int main() {
cparse_startup();
// ... Your code goes here ...
} There is one caveat: If you do include this file you should not include the object file Also, you must not include this I liked the way it turned out. If this solves your problem you may mark this issue as solved. I will later update the Wiki so this option is explained to everyone. |
Thanks for the update, this solution is similar to what i'm doing, i have to add features anyways so keeping the built-in features in my project and only using the core as a library is a great solution. I will close the issue now thank you again ! |
Hi , i want to use this parser in a project we are currently working on.
We are developing on windows and use visual studio, i have always been the IDE guy so i have no idea how makefiles work i tried to create a project adding the files (following my understanding of the makefile - yes i did some reading on makefiles-) but i can't get it to work.
if i understand correctly , there are 2 libraries one is core and the second is the builtin fuctions so i need to create the first .lib file using the files of the core, then compile the built-in-features library that is dependent on the core one.
and of course there is the testing file.
i hope it's not too much to ask, i really like the project and it fits perfectly for my needs specially the fact that i can augment it with my own features.
Thank you in advance.
The text was updated successfully, but these errors were encountered: