I am just starting C++ and downloaded a compiler and an IDE, both eclipse, and tried to make my first C++ program. I use the Hello World C++ Makefile Project, and add the all the stuff on the next page. I then build the program, and the build says this:
12:30:00 **** Build of configuration Default for project HelloWorld! **** make all Cannot run program "make": Launching failed
Error: Program "make" not found in PATH PATH=[C:/Program Files
(x86)/Java/jre1.8.0_91/bin/client;C:/Program Files
(x86)/Java/jre1.8.0_91/bin;C:/Program Files
(x86)/Java/jre1.8.0_91/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\Program
Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files
(x86)\Common Files\Microsoft Shared\Windows
Live;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program
Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files
(x86)\Common Files\Roxio Shared\DLLShared\;c:\Program Files
(x86)\Common Files\Roxio Shared\12.0\DLLShared\;C:\Program Files
(x86)\Windows Live\Shared;c:\Program Files (x86)\Microsoft SQL
Server\100\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL
Server\100\DTS\Binn\;C:\Users\Jen\Desktop\eclipse;] 12:30:00 Build
Finished (took 122ms)***
I run the program, and it says:
Launch failed. Binary not found.
This is the code for the program:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
puts("Hello World!");
return EXIT_SUCCESS;
}
There are two errors, too:
Function "puts" couldn't be resolved.
Symbol "EXIT_SUCCESS" couldn't be resolved.
Thanks in advance!
Nate N.
/////////////////////////////////////////////////////////////////////////
I followed the advise of user4581301 and the code now says this:
#include <iostream>
using namespace std;
int main() {
cout << "Hi World" << endl; // prints Hi World
return 0;
}
The build looks like this:
13:22:26 **** Rebuild of configuration Debug for project HiWorld ****
Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src\HiWorld.o" "..\src\HiWorld.cpp"
g++ -o HiWorld.exe "src\HiWorld.o"
13:22:27 Build Finished (took 835ms)
But now the program, although it does run, doesn't print anything.
Thanks in advance,
Nate N.
Launch failed. Binary not found.
well this is shown because you have 2 errors.
any error means = no binary compiled/linked
no binary compiled/linked = cant launch something which doesnt exist
solution = fixing the errors
#include #include
^ also this is not valid
Cannot run program "make": Launching failed Error: Program "make" not found in PATH
Kaboom! No make, no build, no binary to run.
Some compilers don't ship with Make out of the box, but I don't see any signs of a compiler toolchain in your path at all.
Eclipse is an IDE with support for a wide variety of different compilers. as a result it does not ship with one. Since the error message shows you are building on Windows, your simplest option is one of the many MinGW variants. And Since you are just starting, I recommend starting off with the plain-vanilla MinGW as Eclipse requires next to no extra configuration to use it.
Just make sure you follow the instructions to install msys along with MinGW to get make.
Related
I have been trying for a while now. I have been asked to do a few modifications on a big program, and it requires a lot of libs. All of them were succesfully added, except mysql.
I downloaded the libs several times and tried a lot of times.
I am on Windows using Netbeans and C++.
The test I decided to do is simple: create an empty program and try to include mysql. I didn't have any success:
#include <cstdlib>
#include <mysql/mysql.h>
using namespace std;
int main(int argc, char** argv) {
return 0;
}
This program won't work even if I replace #include <mysql/mysql.h> with #include <mysql.h>.
The error NetBeans gives me is the following:
main.cpp:15:25: fatal error: mysql/mysql.h: No such file or directory
These images show how I altered the project options on Linker and C/C++ options:
Parameters
The folder showing on the C image does contain a mysql.h, i triple checked twice.
I also have added the paths with includes to CodeAssistance.
Many similar questions were left unanswered for years now on several forums, even on stackoverflow, and I can't seem to work this out. This thread may have a final answer to those of us who stumble upon this.
It is not able to find the file
At this point, your program would be pointing to something like this:
cl /I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
mysql1.c
So you needed to include the directory that contains mysql.h as well. So the above would changed to:
cl /I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
/I "C:\Program Files\MySQL\MySQL Server 5.5\include" mysql1.c
verify the header file exist in the path /usr/include/mysql/mysql.h or installed some where else. If you have installed the header files somewhere else ( add that location with -I/.
I have trouble getting Tensorflow to work in my c++ environment: Eclipse.
I git cloned tensorflow, built with bazel, and installed the resulting pip-package exactly like described here:
https://www.tensorflow.org/versions/r0.7/get_started/os_setup.html#installing-from-sources
I created a new c++ project in Eclipse and added the /home/tensorflow to the include paths. However, when I try to build a simple "hello world" project with a few includes from TF I run into this error:
23:05:39 **** Incremental Build of configuration Debug for project cat_face ****
Info: Internal Builder is used for build
g++ -I/home/name/tensorflow -O0 -g3 -Wall -c -fmessage-length=0 -o src/cat_face.o ../src/cat_face.cpp
In file included from ../src/cat_face.cpp:2:0:
/home/name/tensorflow/tensorflow/core/public/session.h:22:48: fatal error: tensorflow/core/framework/graph.pb.h: No such file or directory
#include "tensorflow/core/framework/graph.pb.h"
^
compilation terminated.
23:05:39 Build Finished (took 186ms)
It seems to look for a file, which doesn't exist in the Tensorflow directory. Why is it looking for something that doesn't exist? I checked it out and the file really isn't there, even though I followed all steps.
My program was very simple:
#include <iostream>
#include "/tensorflow/core/public/session.h"
#include "/tensorflow/core/platform/env.h"
using namespace std;
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
}
Where could this have gone wrong?
I think you are supposed to use bazel instead of cmake and make to build you project.
From what I know graph.pb.h is created by bazel during the build process.
Someone else had a similar problem: https://github.com/tensorflow/tensorflow/issues/1890
I'm trying to compile a simple "Hello" program on Windows 7 x64:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
cout << "Hello" << endl;
return 0;
}
And getting an error in the NetBeans IDE when compiling:
CLEAN SUCCESSFUL (total time: 126ms)
D:\GDrive\CS\Cpp\NetBeans_Cpp\TNB_cpp\Tut1_10_HelloWorld\Makefile -f nbproject/Makefile-Debug.mk build/Debug/MinGW-Windows/main.o
Cannot run program "D:\GDrive\CS\Cpp\NetBeans_Cpp\TNB_cpp\Tut1_10_HelloWorld\Makefile" (in directory "D:\GDrive\CS\Cpp\NetBeans_Cpp\TNB_cpp\Tut1_10_HelloWorld"): CreateProcess error=193, %1 is not a valid Win32 application
COMPILE FILE FAILED (exit value -2, total time: 16ms)
My PATH env variable looks like this:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;F:\Program_Files\JDK\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;F:\Program_Files\MinGW\bin;F:\Program_Files\MinGW\msys\1.0\bin;
The last two varibles being probably the most important since they pertain to the MinGW. My ideas is that something is missing in the PATH, but maybe its not where the problem hiddes.
Thanks.
It looks as if some settings are wrong.
Look at your Netbeans settings : Toolchain : Make Command
looking after one of the files.
make.exe
mingw32-make.exe.
In the directories, for example,
c:\msys\1.0\bin
c:\MinGW\bin
goto -> options -> c/c++ -> Build Tools
and check if the settings match this
Recently my gnu makefile stopped linking my C++ project. I had made some changes. I have copied the link line out and run it from a batch file. It builds fine. But the same line strangely fails when I run make. The error it gives is:
LINK : fatal error LNK1181: cannot open input file 'user32.lib'
which has to be a red herring because from the same command line prompt, running the link command succeeds. I am beginning to suspect GNU make. This used to work from within make but I made a few additions and changes to the makefile to get it building on Linux which seemed to introduce the problem.
I am using :
GNU Make 3.80
MS Visual C++ Linker 10.00.40219.01
on Windows XP.
My LIB and LIBPATH both include the path to the SDK directory which contains the libraries. My link command is as follows:
link C:\SDL-1.2.14\lib\SDL.lib C:\SDL-1.2.14\lib\SDLmain.lib C:\SDL-1.2.14\lib\SDL_image.lib C:\SDL-1.2.14\lib\SDL_ttf.lib C:\SDL-1.2.14\lib\SDL_mixer.lib C:\SDL-1.2.14\lib\SDL_net.lib ../../build/lib/sdlhal.lib user32.lib gdi32.lib kernel32.lib oldnames.lib wsock32.lib advapi32.lib comdlg32.lib comctl32.lib wsock32.lib winmm.lib netapi32.lib OpenGL32.lib glu32.lib /nologo /incremental:no -subsystem:console /PDB:../../build/bin/Prog.pdb /OUT:../../build/bin/Prog.exe /MAP:../../build/bin/Prog.map ../../build/Prog/intr/util.obj ../../build/Prog/intr/objwithvel.obj ../../build/Prog/intr/rock.obj ../../build/Prog/intr/explosion.obj ../../build/Prog/intr/ship.obj ../../build/Prog/intr/photon.obj ../../build/Prog/intr/world.obj ../../build/Prog/intr/test.obj ../../build/Prog/intr/main.obj
EDIT: Bit of progress with C++ program below. My Environment variables were:
LIB=C:\Program Files\Microsoft Visual Studio 10.0\VC\LIB;C:\Program Files\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB;C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib;
LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\Program Files\Microsoft Visual Studio 10.0\VC\LIB;C:\Program Files\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB;
But when printed out by program run from within make, they are:
LIB=.lib
LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\WINDOWS\Microsoft.NETFramework\v3.5;C:\Program Files\Microsoft Visual Studio 10.0\VC\LIB;C:\Program Files\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB;
Based on your description of the value of LIB, I suspect that you have simply set the "LIB" variable in your makefile (to ".lib"). In standard GNU make (actually, all versions of make) all the environment variables are imported into make as make variables when make starts up (there are exceptions, such as SHELL, which are handled differently).
Whenever make invokes a command, all the current values of variables that were imported are written out to the environment of the child process.
Put another way, any variable that make read from its environment is considered to be marked for export when make runs any command from a recipe.
So if you have a makefile like this:
LIB = .lib
all: ; #echo "LIB = %LIB%"
and you run it like this:
> set LIB=C:\foo;C:\bar
> make
then the output will be "LIB = .lib", not "LIB = C:\foo;C:\bar"
I suspect that your LIB and LIBPATH variables aren't set the way you think they are when link is invoked from make.
Try creating your own link.exe program that gets invoked from make and dumps the command line and environment. That'll tell you for certain whether or not the variables are set correctly by the makefile.
#include <stdlib.h>
#include <stdio.h>
int main( int argc, char** argv, char** env)
{
int i = 0;
for (i = 0; i < argc; ++i, ++argv) {
if (!(*argv)) {
*argv = "(null)";
}
printf( "arg[%d]: \"%s\"\n", i, *argv);
}
puts("\nENVIRONMENT...\n");
while (*env) {
printf( "%s\n", *env);
++env;
}
return 0;
}
Also check that there aren't unquoted spaces in the wrong place in the link command line. While it would seem to be unrelated to the error you mention in the question (and is probably really just a cut/paste error), the link command line you gave has a space in the middle of the path/file name for explosion.obj.
This is likely to be a path issue. Are you using the mingw version of GNU make, or the Cygwin version?
One way to debug this is to put an echo $LIB and echo $LIBPATH command into the make recipe to confirm that these are getting set as you expect.
I installed CodeBlocks 10.5 with minGW compiler. After setting environment variables for minGW I cheked gcc -v on cmd and it is working fine.
The problem is that, I have made a small program in CodeBlocks project the code is below
#include <iostream>
#include <allegro5/allegro.h>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
There is an error, the build log is:
Compiling: main.cpp
C:\Program Files\CodeBlocks\MinGW\bin\allegro_pract… error: allegro5/allegro.h: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
Directory structure for codeblocks is:
C:\Program Files\CodeBlocks
and for minGW:
C:\Program Files\CodeBlocks\mingw
and my project is:
C:\Program Files\CodeBlocks\bin\
i am confused about allegro library where to place it.. as I have not used any external library..
the library is placed now at:
C:\Program Files\CodeBlocks\mingw\allegro\
I am "Googling" for a long time but no tutorial seems to be working..
please give a valid solution.. and where to place allegro library..??
Do not try to "place" libraries in the "right place". Instead, tell the IDE where you put them explicitly. This is called setting the include path.
Code::Blocks should have some setting for include directories. You should point it to the place where Allegro lives.
Set up your IDE to look for Allegro:
(source: allegro.cc)
The complete tutorial is here:
http://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_10.05_and_Allegro_5
http://www.mingw.org/wiki/IncludePathHOWTO:
The actual search path, for any specific installation of MinGW may be determined, by running the compiler itself, with the "-v" option; typically, for a GCC-3.4.5 installation in c:/mingw:--
defaults appear to be:
c:/mingw/include/c++/3.4.5
c:/mingw/include/c++/3.4.5/mingw32
c:/mingw/include/c++/3.4.5/backward
c:/mingw/include
c:/mingw/lib/gcc/mingw32/3.4.5/include
I don't use mingw, so, read the link.