Compiling multiple files to exe









up vote
1
down vote

favorite












I got multiple files to compile to a standalone exe using cython.



compile.py



from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext_modules = [
Extension("TheMainFile", ["TheMainFile.py"]),
Extension("HelperClass", ["HelperClass.py"]),
Extension("HelperClass2", ["HelperClass2.py"]),
]

setup(
name = 'Main',
cmdclass = 'build_ext': build_ext,
ext_modules = ext_modules
)


The main file that should be run by the exe is TheMainFile



running the following command



python .compiler.py build_ext --inplace


creates 3 .c files, in the build dir however is no .exe, just .lib,.exp and .obj files.



Manually adding these files to a VS Projects to build, results in the following error



"Python.h": No such file or directory


Adding the following files to the project from C:Pythoninclude lastly results in "structmember.h": No such file or directory



My question is:
How do I compile these files to a binary where TheMainFile is executed.










share|improve this question





















  • Have you read stackoverflow.com/questions/52959902/…? Cython is mostly designed to make compiled modules instead of executables (but it is possible), and it isn't really designed to compile multiple source files to one object (but it is possible with a lot of work). You can do what you want but it isn't well supported.
    – DavidW
    Nov 10 at 12:45










  • @DavidW tried that approach with gcc, but then the above errors with no file found appears
    – 0x45
    Nov 10 at 12:51










  • You can work out the path to add to find "Python.h" with the command python-config --includes
    – DavidW
    Nov 10 at 13:38










  • @DavidW if you read the question, you'll see I included it ;)
    – 0x45
    Nov 10 at 16:30










  • In the question you say you added some files to your visual studio project, not that you set the include path (which is what Python expects you to do). However I don't really understand visual studio projects well enough to say any more so I'll stop here
    – DavidW
    Nov 10 at 17:34














up vote
1
down vote

favorite












I got multiple files to compile to a standalone exe using cython.



compile.py



from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext_modules = [
Extension("TheMainFile", ["TheMainFile.py"]),
Extension("HelperClass", ["HelperClass.py"]),
Extension("HelperClass2", ["HelperClass2.py"]),
]

setup(
name = 'Main',
cmdclass = 'build_ext': build_ext,
ext_modules = ext_modules
)


The main file that should be run by the exe is TheMainFile



running the following command



python .compiler.py build_ext --inplace


creates 3 .c files, in the build dir however is no .exe, just .lib,.exp and .obj files.



Manually adding these files to a VS Projects to build, results in the following error



"Python.h": No such file or directory


Adding the following files to the project from C:Pythoninclude lastly results in "structmember.h": No such file or directory



My question is:
How do I compile these files to a binary where TheMainFile is executed.










share|improve this question





















  • Have you read stackoverflow.com/questions/52959902/…? Cython is mostly designed to make compiled modules instead of executables (but it is possible), and it isn't really designed to compile multiple source files to one object (but it is possible with a lot of work). You can do what you want but it isn't well supported.
    – DavidW
    Nov 10 at 12:45










  • @DavidW tried that approach with gcc, but then the above errors with no file found appears
    – 0x45
    Nov 10 at 12:51










  • You can work out the path to add to find "Python.h" with the command python-config --includes
    – DavidW
    Nov 10 at 13:38










  • @DavidW if you read the question, you'll see I included it ;)
    – 0x45
    Nov 10 at 16:30










  • In the question you say you added some files to your visual studio project, not that you set the include path (which is what Python expects you to do). However I don't really understand visual studio projects well enough to say any more so I'll stop here
    – DavidW
    Nov 10 at 17:34












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I got multiple files to compile to a standalone exe using cython.



compile.py



from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext_modules = [
Extension("TheMainFile", ["TheMainFile.py"]),
Extension("HelperClass", ["HelperClass.py"]),
Extension("HelperClass2", ["HelperClass2.py"]),
]

setup(
name = 'Main',
cmdclass = 'build_ext': build_ext,
ext_modules = ext_modules
)


The main file that should be run by the exe is TheMainFile



running the following command



python .compiler.py build_ext --inplace


creates 3 .c files, in the build dir however is no .exe, just .lib,.exp and .obj files.



Manually adding these files to a VS Projects to build, results in the following error



"Python.h": No such file or directory


Adding the following files to the project from C:Pythoninclude lastly results in "structmember.h": No such file or directory



My question is:
How do I compile these files to a binary where TheMainFile is executed.










share|improve this question













I got multiple files to compile to a standalone exe using cython.



compile.py



from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext_modules = [
Extension("TheMainFile", ["TheMainFile.py"]),
Extension("HelperClass", ["HelperClass.py"]),
Extension("HelperClass2", ["HelperClass2.py"]),
]

setup(
name = 'Main',
cmdclass = 'build_ext': build_ext,
ext_modules = ext_modules
)


The main file that should be run by the exe is TheMainFile



running the following command



python .compiler.py build_ext --inplace


creates 3 .c files, in the build dir however is no .exe, just .lib,.exp and .obj files.



Manually adding these files to a VS Projects to build, results in the following error



"Python.h": No such file or directory


Adding the following files to the project from C:Pythoninclude lastly results in "structmember.h": No such file or directory



My question is:
How do I compile these files to a binary where TheMainFile is executed.







python-3.x compilation python-3.6 cython






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 10 at 12:37









0x45

284314




284314











  • Have you read stackoverflow.com/questions/52959902/…? Cython is mostly designed to make compiled modules instead of executables (but it is possible), and it isn't really designed to compile multiple source files to one object (but it is possible with a lot of work). You can do what you want but it isn't well supported.
    – DavidW
    Nov 10 at 12:45










  • @DavidW tried that approach with gcc, but then the above errors with no file found appears
    – 0x45
    Nov 10 at 12:51










  • You can work out the path to add to find "Python.h" with the command python-config --includes
    – DavidW
    Nov 10 at 13:38










  • @DavidW if you read the question, you'll see I included it ;)
    – 0x45
    Nov 10 at 16:30










  • In the question you say you added some files to your visual studio project, not that you set the include path (which is what Python expects you to do). However I don't really understand visual studio projects well enough to say any more so I'll stop here
    – DavidW
    Nov 10 at 17:34
















  • Have you read stackoverflow.com/questions/52959902/…? Cython is mostly designed to make compiled modules instead of executables (but it is possible), and it isn't really designed to compile multiple source files to one object (but it is possible with a lot of work). You can do what you want but it isn't well supported.
    – DavidW
    Nov 10 at 12:45










  • @DavidW tried that approach with gcc, but then the above errors with no file found appears
    – 0x45
    Nov 10 at 12:51










  • You can work out the path to add to find "Python.h" with the command python-config --includes
    – DavidW
    Nov 10 at 13:38










  • @DavidW if you read the question, you'll see I included it ;)
    – 0x45
    Nov 10 at 16:30










  • In the question you say you added some files to your visual studio project, not that you set the include path (which is what Python expects you to do). However I don't really understand visual studio projects well enough to say any more so I'll stop here
    – DavidW
    Nov 10 at 17:34















Have you read stackoverflow.com/questions/52959902/…? Cython is mostly designed to make compiled modules instead of executables (but it is possible), and it isn't really designed to compile multiple source files to one object (but it is possible with a lot of work). You can do what you want but it isn't well supported.
– DavidW
Nov 10 at 12:45




Have you read stackoverflow.com/questions/52959902/…? Cython is mostly designed to make compiled modules instead of executables (but it is possible), and it isn't really designed to compile multiple source files to one object (but it is possible with a lot of work). You can do what you want but it isn't well supported.
– DavidW
Nov 10 at 12:45












@DavidW tried that approach with gcc, but then the above errors with no file found appears
– 0x45
Nov 10 at 12:51




@DavidW tried that approach with gcc, but then the above errors with no file found appears
– 0x45
Nov 10 at 12:51












You can work out the path to add to find "Python.h" with the command python-config --includes
– DavidW
Nov 10 at 13:38




You can work out the path to add to find "Python.h" with the command python-config --includes
– DavidW
Nov 10 at 13:38












@DavidW if you read the question, you'll see I included it ;)
– 0x45
Nov 10 at 16:30




@DavidW if you read the question, you'll see I included it ;)
– 0x45
Nov 10 at 16:30












In the question you say you added some files to your visual studio project, not that you set the include path (which is what Python expects you to do). However I don't really understand visual studio projects well enough to say any more so I'll stop here
– DavidW
Nov 10 at 17:34




In the question you say you added some files to your visual studio project, not that you set the include path (which is what Python expects you to do). However I don't really understand visual studio projects well enough to say any more so I'll stop here
– DavidW
Nov 10 at 17:34

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239025%2fcompiling-multiple-files-to-exe%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239025%2fcompiling-multiple-files-to-exe%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線