I have been working on a program built using the Windows Application template.
It has been working just fine, I now have almost 400 lines of code and until
now it has let me compile it. Suddenly, I go to compile and it gives me a
Permission Denied error.
In wxDev-C++ 7.0.0.92 it says Permission Denied.
In Dev-C++ portable 4.9.9.2 it is more specific and says undefined reference
to '__cpu_features_init'
I rebooted the computer, it let me compile, then I made a simple change and it
denied me again.
Here is the log from Dev-C++ portable 4.9.9.2... it is significantly shorter
than the wxDev version (fewer libraries to link).
This program builds ok in MSVC 2008 Express (though I have to change a number
of things because Microsoft has its own way of working) but I want it in Dev
because it is less complicated and I want to be able to just put the .EXE onto
someone's computer and it works and not have to include the .NET framework or
any of that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Incidentally, when I take the program and paste it into a console program
template (and change the MessageBox functions into cout <<, which is the only
Windows function I am using right now), it compiles fine. (It is a simple
program to take a file dragged into it and rename it based on the content and
move it to a folder, and I only have user output to inform if there is an
error.) I want it in the Windows template to avoid having to run DOS programs
in Windows, since they can have funny side-effects. (I am porting from Turbo
Pascal 5.5 for DOS because I tried to add a simple portion that involved
opening a second file, and just doing that gave me a buffer overflow and I
couldn't overcome memory constraints even though the program doesn't really
use much memory... because Windows is funny how it handles DOS applications.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In Dev-C++ portable 4.9.9.2 it is more
specific and says undefined reference
to '__cpu_features_init'
Different error messages may mean different problems; you should either post
both logs or stick to one compiler (at least until you have resolved the
issue). The '__cpu_features_init' error occurs when you have multiple
installations of differing versions of GNU tools installed causing the build
to using an incompatible mix or toolchain components. It could just be that
your use of Portable Dev-C++ and wxDev-C++ on the same machine is causing the
problem. When Dev-C++ performs a build it adds the toolchain paths to the end of the path environment variable - this causes a problem if another tool
with executables with identical names has added its path before that. It is
a stupid bug that would be easily solved by appending to PATH rather than
prepending; but Dev-C++ is no longer maintained, but you may get a fix in
wxDev-C++. You might also fix it by manually prepending c:\dev-cpp\bin (or
whatever your toolchain path is) to the PATH environment variable; but be
aware that that will probably break the other GNU toolchain installation until
you remove it again.
This program builds ok in MSVC 2008
Express (though I have to change a
number of things because Microsoft has
its own way of working
To be honest, you are better off with VC++2008; I wonder what it is you have
to change? It should be possible to create Win32 code that is portable between
compilers. The trick here is not to let VC++ populate your project with its
own template and precompiled header code; you don't need any of that, and it
is non-portable. Just create a Win32 Project and in the Application settings,
select "Windows Program" and "Empty Project", then add your existing code to
the project. If the code itself does not compile, the fixes should be simple
and it should be possible to make it entirely portable.
I have never tried it, but I believe that wxDev-C++ supports VC++ as its back-
end tool chain.
I want it in the Windows template to avoid having to run DOS programs in
Windows
It is not a DOS program. The MinGW compiler used by Dev-C++ cannot produce DOS
programs. What you are building there is a Win32 Console Mode program - it is
no less a 32 bit Win32 OS program, it is simply not a GUI program. To that end
it has no DOS memory constraints, and can access all Win32 API calls (though
some of course are not relevant to console apps).
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, that gives me some things to work with. I have been mainly using wxDev
because it has a nicer IDE and I was thinking before I got MSVC 2008 Express
that I might use it for the GUI capability but I have also heard that it is
tough to work with because the GUI is not WYSIWYG. Still, its editing
capabilities are miles from Dev 4.9.9.2 portable so I should just nix that.
I suppose I can just use the console mode if it solves my problem. I will just
have to change slightly the way the program parses the command line, because
that is different between Win32 and command line programs.
As far as the changes I had to make, it is because I used the template in MSVC
and so it wanted everything in Unicode and remapped a number of the commands
to the Unicode version. I will try with a blank template. I am curious to see
if I move an EXE created in MSVC to a different computer that doesn't have the
framework, if I don't use .NET commands, will it run or will it tell me it is
missing something, because that is one of the reasons I want to use Dev C++
for this project. (And I don't like that MSVC makes so many files when I start
a project and it is confusing.)
Thanks.
-Dan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Heavens, I posted too quickly. I figured out why I was getting a Permission
Denied error; it's because my program was running crashed in the background...
once I killed it in the task manager, I was allowed to compile again. (I
figured it out because I got a few copies of it running and it slowed down my
system so much I was trying to close my programs to shut down and went in to
the task manager to see what was running and there it was.)
BTW, using a blank template in MSVC 2008 does work, I was able to paste in my
code as is and add it to the blank project and it was exactly the same
behavior as in Dev C++. Now I just have to see if it will distribute as a
stand-alone EXE.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am curious to see if I move an EXE
created in MSVC to a different
computer that doesn't have the
framework, if I don't use .NET
commands, will it run or will it tell
me it is missing something,
If you are using the full version of Visual Studio, you should use teh
Deployment Wizard to create an installer. This does not come with the Express
Edition (although it does in C# Express). That will either pack the
dependencies with the installer or the installer will download them. However
if you are using C++ Express, without the .NET/CLR framework (i.e. a native
Win32 app), then you at least need to install the VC++ redistributable package
on the client computer. This is because VC++ uses newer libraries not
distributed with Windows, whereas Dev-C++ uses MSVCRT.DLL which is from VC++ 6
and is distributed with Windows. The VC++ redistruibutable can be found .
And I don't like that MSVC makes so many files when I start a project and it
is confusing
Starting with an empty project helps. The files that are still then created
are the project, solution (for multiple related projects), and a database that
supports the code browsing and completion features.
I figured out why I was getting a Permission Denied error; it's because my
program was running crashed in the background
Which is what I was going to suggest had you come back to that issue, but the
original details were all to do with the mess up caused by multiple compilers.
As I said at the beginning "Different error messages may mean different a
problem", if you implement a solution that causes a different error, it is
generally best not to fix that error but to go back to the original problem
and solve that. In this case, had you solved the compiler conflict, you'd have
still ended up with this same problem.
Thank you. Yeah, I realize I would have still had the same problem.
After spending hours and hours putting in MessageBox commands to track down
what lines the program is getting to, then commenting out and uncommenting and
such, I finally decided that I will copy my code to MSVC and use the debugger,
then copy back into Dev C++ and make the EXE file so I can send it out without
extra installation concerns for now. This particular program is meant to be
simple.
I do have a bigger project I will be doing soon and for that I will learn
Microsoft better and use it. I wish I could avoid CLR but it seems inevitable
if I wish to use the editor, and it is too much trouble to use wxwidgets so
I'll just have to deal with it. However, the people who will use the bigger
project will be more programming-oriented so it shouldn't be as big of a deal
to tell them how to download the .NET framework and redistributable package
and such, or to play with some sort of installation program to build an
installer do to the same at that time.
All I can say is all of this has been quite a learning experience... what I
knew about PCs and Windows has totally been blown open in the last few months
when I started researching C++. So much more knowledge is required than with
Visual Basic, which is where I am originally coming from. But now I know why
Windows has the quirks it does.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I wish I could avoid CLR but it seems inevitable if I wish to use the
editor.
Not true at all. You can select a Win32 or Win32 Console application and there
will be no CLR or .NET requirement; though you will still need the
redistributable. Your best bet would be to distribute the redistributable with
your code and write a simple installer.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have been working on a program built using the Windows Application template.
It has been working just fine, I now have almost 400 lines of code and until
now it has let me compile it. Suddenly, I go to compile and it gives me a
Permission Denied error.
In wxDev-C++ 7.0.0.92 it says Permission Denied.
In Dev-C++ portable 4.9.9.2 it is more specific and says
undefined reference to '__cpu_features_init'
I rebooted the computer, it let me compile, then I made a simple change and it
denied me again.
Here is the log from Dev-C++ portable 4.9.9.2... it is significantly shorter
than the wxDev version (fewer libraries to link).
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\cppcode\convert.cpp" -o "C:\cppcode\convert.exe" -I"C:\Dev-
CppPortable\App\devcpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-
CppPortable\App\devcpp\include\c++\3.4.2\backward" -I"C:\Dev-
CppPortable\App\devcpp\include\c++\3.4.2\mingw32" -I"C:\Dev-
CppPortable\App\devcpp\include\c++\3.4.2" -I"C:\Dev-
CppPortable\App\devcpp\include" -I"C:\cppcode\AS400LIBS" -L"C:\Dev-
CppPortable\App\devcpp\lib" -L"C:\cppcode\AS400LIBS"
/mingw/lib/crt2.o(.text+0x167):crt1.c: undefined reference to
`__cpu_features_init'
collect2: ld returned 1 exit status
Execution terminated
This program builds ok in MSVC 2008 Express (though I have to change a number
of things because Microsoft has its own way of working) but I want it in Dev
because it is less complicated and I want to be able to just put the .EXE onto
someone's computer and it works and not have to include the .NET framework or
any of that.
Incidentally, when I take the program and paste it into a console program
template (and change the MessageBox functions into cout <<, which is the only
Windows function I am using right now), it compiles fine. (It is a simple
program to take a file dragged into it and rename it based on the content and
move it to a folder, and I only have user output to inform if there is an
error.) I want it in the Windows template to avoid having to run DOS programs
in Windows, since they can have funny side-effects. (I am porting from Turbo
Pascal 5.5 for DOS because I tried to add a simple portion that involved
opening a second file, and just doing that gave me a buffer overflow and I
couldn't overcome memory constraints even though the program doesn't really
use much memory... because Windows is funny how it handles DOS applications.)
Different error messages may mean different problems; you should either post
both logs or stick to one compiler (at least until you have resolved the
issue). The '__cpu_features_init' error occurs when you have multiple
installations of differing versions of GNU tools installed causing the build
to using an incompatible mix or toolchain components. It could just be that
your use of Portable Dev-C++ and wxDev-C++ on the same machine is causing the
problem. When Dev-C++ performs a build it adds the toolchain paths to the
end of the path environment variable - this causes a problem if another tool
with executables with identical names has added its path before that. It is
a stupid bug that would be easily solved by appending to PATH rather than
prepending; but Dev-C++ is no longer maintained, but you may get a fix in
wxDev-C++. You might also fix it by manually prepending c:\dev-cpp\bin (or
whatever your toolchain path is) to the PATH environment variable; but be
aware that that will probably break the other GNU toolchain installation until
you remove it again.
To be honest, you are better off with VC++2008; I wonder what it is you have
to change? It should be possible to create Win32 code that is portable between
compilers. The trick here is not to let VC++ populate your project with its
own template and precompiled header code; you don't need any of that, and it
is non-portable. Just create a Win32 Project and in the Application settings,
select "Windows Program" and "Empty Project", then add your existing code to
the project. If the code itself does not compile, the fixes should be simple
and it should be possible to make it entirely portable.
I have never tried it, but I believe that wxDev-C++ supports VC++ as its back-
end tool chain.
It is not a DOS program. The MinGW compiler used by Dev-C++ cannot produce DOS
programs. What you are building there is a Win32 Console Mode program - it is
no less a 32 bit Win32 OS program, it is simply not a GUI program. To that end
it has no DOS memory constraints, and can access all Win32 API calls (though
some of course are not relevant to console apps).
Clifford
Ok, that gives me some things to work with. I have been mainly using wxDev
because it has a nicer IDE and I was thinking before I got MSVC 2008 Express
that I might use it for the GUI capability but I have also heard that it is
tough to work with because the GUI is not WYSIWYG. Still, its editing
capabilities are miles from Dev 4.9.9.2 portable so I should just nix that.
I suppose I can just use the console mode if it solves my problem. I will just
have to change slightly the way the program parses the command line, because
that is different between Win32 and command line programs.
As far as the changes I had to make, it is because I used the template in MSVC
and so it wanted everything in Unicode and remapped a number of the commands
to the Unicode version. I will try with a blank template. I am curious to see
if I move an EXE created in MSVC to a different computer that doesn't have the
framework, if I don't use .NET commands, will it run or will it tell me it is
missing something, because that is one of the reasons I want to use Dev C++
for this project. (And I don't like that MSVC makes so many files when I start
a project and it is confusing.)
Thanks.
-Dan
Heavens, I posted too quickly. I figured out why I was getting a Permission
Denied error; it's because my program was running crashed in the background...
once I killed it in the task manager, I was allowed to compile again. (I
figured it out because I got a few copies of it running and it slowed down my
system so much I was trying to close my programs to shut down and went in to
the task manager to see what was running and there it was.)
BTW, using a blank template in MSVC 2008 does work, I was able to paste in my
code as is and add it to the blank project and it was exactly the same
behavior as in Dev C++. Now I just have to see if it will distribute as a
stand-alone EXE.
If you are using the full version of Visual Studio, you should use teh
Deployment Wizard to create an installer. This does not come with the Express
Edition (although it does in C# Express). That will either pack the
dependencies with the installer or the installer will download them. However
if you are using C++ Express, without the .NET/CLR framework (i.e. a native
Win32 app), then you at least need to install the VC++ redistributable package
on the client computer. This is because VC++ uses newer libraries not
distributed with Windows, whereas Dev-C++ uses MSVCRT.DLL which is from VC++ 6
and is distributed with Windows. The VC++ redistruibutable can be found .
Starting with an empty project helps. The files that are still then created
are the project, solution (for multiple related projects), and a database that
supports the code browsing and completion features.
Which is what I was going to suggest had you come back to that issue, but the
original details were all to do with the mess up caused by multiple compilers.
As I said at the beginning "Different error messages may mean different a
problem", if you implement a solution that causes a different error, it is
generally best not to fix that error but to go back to the original problem
and solve that. In this case, had you solved the compiler conflict, you'd have
still ended up with this same problem.
: http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7
-A40D-3802B2AF5FC2&displaylang=en
Thank you. Yeah, I realize I would have still had the same problem.
After spending hours and hours putting in MessageBox commands to track down
what lines the program is getting to, then commenting out and uncommenting and
such, I finally decided that I will copy my code to MSVC and use the debugger,
then copy back into Dev C++ and make the EXE file so I can send it out without
extra installation concerns for now. This particular program is meant to be
simple.
I do have a bigger project I will be doing soon and for that I will learn
Microsoft better and use it. I wish I could avoid CLR but it seems inevitable
if I wish to use the editor, and it is too much trouble to use wxwidgets so
I'll just have to deal with it. However, the people who will use the bigger
project will be more programming-oriented so it shouldn't be as big of a deal
to tell them how to download the .NET framework and redistributable package
and such, or to play with some sort of installation program to build an
installer do to the same at that time.
All I can say is all of this has been quite a learning experience... what I
knew about PCs and Windows has totally been blown open in the last few months
when I started researching C++. So much more knowledge is required than with
Visual Basic, which is where I am originally coming from. But now I know why
Windows has the quirks it does.
Not true at all. You can select a Win32 or Win32 Console application and there
will be no CLR or .NET requirement; though you will still need the
redistributable. Your best bet would be to distribute the redistributable with
your code and write a simple installer.