Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: MRufus on June 04, 2010, 05:22:42 pm

Title: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: MRufus on June 04, 2010, 05:22:42 pm
I am working on latest distro of Ubuntu on Codeblocks and trying to compile this code


/*
 * Acquisition over network cameras. Seem to work only with ffmpeg
 *
 * For macosx users, install ffmpeg (e.g. from fink) and recompile opencv this way
 * http://stackoverflow.com/questions/583969/compile-opencv-on-mac-with-ffmpeg-instead-of-quicktime
 *
 */
#include "cv.h"
#include "highgui.h"

#include <iostream>

#define MISSING_FRAMES_TIMEOUT 10

using namespace std;
// Uncomment if you have OpenCV + FFMPEG
#define HAVE_FFMPEG
#ifdef HAVE_FFMPEG
extern CvCapture* cvCreateFileCapture_FFMPEG( const char* filename );
#endif

/**
 *   Main entry point of Motion. Launches all the motion threads and contains
 *   the logic for starting up, restarting and cleaning up everything.
 */
int main (int argc, char **argv) {

#ifdef HAVE_FFMPEG
  /* If i is 0 it means no thread files and we then set the thread number to 1 */

  string host("http://at@15.12.156.145/mjpg/video.mjpg");
 CvCapture *capture = cvCreateFileCapture_FFMPEG(host.c_str());
  string winBlobsName("Camera over network");
  cvNamedWindow(winBlobsName.c_str());
  while (capture) {
    // Grab frame
    int grab=cvGrabFrame(capture );
    if (grab<0) {
      cerr << "Error in capturing frame\n" << endl;
      break;
    }
    // Retrieve frame
    IplImage *img = cvRetrieveFrame(capture);

    cvShowImage(winBlobsName.c_str(),img);

    cvWaitKey(2);

  }
#endif
  return 0;
}

It requires Opencv and ffmpeg which I installed earlier. But when Im trying to compile the code it tells me

Compiling: main.cpp
g++: no input files
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 
If I try to run it it will say that it seems like this project has not been built yet. Would you like to build it? I say yes, it asks me the same question once more I say yes again and then nothing.
If I put in some simple code like hello world it works fine. Did anyone encounter this kind of problem before?
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: Jenna on June 04, 2010, 05:37:06 pm
Please turn on full commandline logging and post the build log here:
change "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline"

And please tell us which version of Code::Blocks you use.
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: MRufus on June 04, 2010, 06:08:19 pm
here is a full build log

g++ -Wall -fexceptions  -g 'pkg-config opencv --cflags' 'sdl-config --cflags'     -c /home/rufat/Desktop/hello/TesttheFFMPEG/main.cpp -o obj/Debug/main.o
g++: no input files
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 

The version of Code blocks I'm using is 8.02
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: MRufus on June 04, 2010, 06:11:20 pm
Additional info:

In order for it to recognize Opencv I had to go to Project build options -> Compiler Settings-> Other options and added
'pkg-config opencv --cflags'
'sdl-config --cflags'

Also in Linker setting -> Other linker options I added 
'pkg-config opencv --libs'
'sdl-config --libs'
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: Jenna on June 04, 2010, 06:57:49 pm
Additional info:

In order for it to recognize Opencv I had to go to Project build options -> Compiler Settings-> Other options and added
'pkg-config opencv --cflags'
'sdl-config --cflags'

Also in Linker setting -> Other linker options I added 
'pkg-config opencv --libs'
'sdl-config --libs'


It looks like you use an apostrope to surround the pkg-config stuff. You need a backtick ( "`" , french grave accent) here.
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: oBFusCATed on June 04, 2010, 07:25:11 pm
Jens: is it possible to show some message when the pkg-config expansion fails?

Probably checking the return code of pkg-config and printing all strerr text in the build log?
Very often I mistype the cflags/libs like cflag/lib or sometimes I type "-" instead of "--" in front of the option.
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: Jenna on June 04, 2010, 07:30:05 pm
I think this should not be too hard.
I will look into it, later (possibly this evening or the weekend).
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: Jenna on June 05, 2010, 09:24:22 am
Jens: is it possible to show some message when the pkg-config expansion fails?

Probably checking the return code of pkg-config and printing all strerr text in the build log?
Very often I mistype the cflags/libs like cflag/lib or sometimes I type "-" instead of "--" in front of the option.

I think this should not be too hard.
I will look into it, later (possibly this evening or the weekend).


Here comes a patch to test:
Code
Index: src/sdk/compilercommandgenerator.cpp
===================================================================
--- src/sdk/compilercommandgenerator.cpp (Revision 6328)
+++ src/sdk/compilercommandgenerator.cpp (Arbeitskopie)
@@ -948,15 +948,35 @@
             #else
             Manager::Get()->GetLogManager()->DebugLog(F(_T("Caching result of `%s`"), cmd.c_str()));
             #endif
-            wxArrayString output;
+            wxArrayString output, error;
             if (platform::WindowsVersion() >= platform::winver_WindowsNT2000)
-                wxExecute(_T("cmd /c ") + cmd, output, wxEXEC_NODISABLE);
+                wxExecute(_T("cmd /c ") + cmd, output, error, wxEXEC_NODISABLE);
             else
-                wxExecute(cmd, output, wxEXEC_NODISABLE);
-            bt = GetStringFromArray(output, _T(" "));
-            // add it in the cache
-            m_Backticks[cmd] = bt;
-            Manager::Get()->GetLogManager()->DebugLog(_T("Cached"));
+                wxExecute(cmd, output, error, wxEXEC_NODISABLE);
+            if(error.GetCount() > 0)
+            {
+                #if wxCHECK_VERSION(2, 9, 0)
+                Manager::Get()->GetLogManager()->DebugLogError(F(_T("Error running: %s"), cmd.wx_str()));
+                #else
+                Manager::Get()->GetLogManager()->DebugLogError(F(_T("Error running: %s"), cmd.c_str()));
+                #endif
+                Manager::Get()->GetLogManager()->DebugLogError(_T("Output is:"));
+                for(size_t i = 0; i < error.GetCount(); ++i)
+                {
+                    #if wxCHECK_VERSION(2, 9, 0)
+                    Manager::Get()->GetLogManager()->DebugLogError(F(_T("%s"), error[i].wx_str()));
+                    #else
+                    Manager::Get()->GetLogManager()->DebugLogError(F(_T("%s"), error[i].c_str()));
+                    #endif
+                }
+            }
+            else
+            {
+                bt = GetStringFromArray(output, _T(" "));
+                // add it in the cache
+                m_Backticks[cmd] = bt;
+                Manager::Get()->GetLogManager()->DebugLog(_T("Cached"));
+            }
         }
         ret << bt << _T(' ');
         str = str.substr(0, start) + bt + str.substr(end + 1, wxString::npos);

I also add it as attachement, otherwise, there might be errors with line-endings.

[attachment deleted by admin]
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: oBFusCATed on June 05, 2010, 02:36:18 pm
Tested the patch on the debugger branch:

The detection happens and there is a log message, but it is displayed in the wrong log ("Debug log").
This log is not show by default, you should run c::b with --debug-log.
Also you should look at the log.

Could you make it to post the error to the build messages and the build log?
If you can't you should use the normal log, which is on by default.
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: Jenna on June 05, 2010, 02:42:58 pm
I think Build log or Build messages are the wqrong place, because the backticked expressions are parsed once on project loading (or at compile time, if they are seen the first time), but both loggers are cleared before building a project and so they would get lost.

I used the debug log, because the messages about evealuating the backticked expressions go there too.

To make them appear in the normal log, just use LogError(...) instead of DebugLogError(...).
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: oBFusCATed on June 05, 2010, 03:14:29 pm
OK, I understand.

Here are the possibilities I've come up:
1. Show the errors in messageboxes, a bit annoying but easy to implement
2. Switch to the Log page, this might fail if the build message or build log are shown at the end of compilation
3. Add a flag to build message/logs to ignore the clear call.
   If there are errors when executing `pkg-config`, then you set this flag to true and add the messages to both logs.
   When the compilation end you set the flag to false.
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: MRufus on June 07, 2010, 05:03:12 pm
Thanks for the help on that one. I still had some problems with the code and so far I was able to solve them, but I ran into a problem here.
The code is the same and when I'm trying to compile it gives me this

Linking console executable: bin/Debug/Hello
obj/Debug/main.o: In function `main':
/home/rufat/Desktop/hello/Hello/main.cpp:36: undefined reference to `cvCreateFileCapture_FFMPEG(char const*)'
/home/rufat/Desktop/hello/Hello/main.cpp:38: undefined reference to `cvNamedWindow'
/home/rufat/Desktop/hello/Hello/main.cpp:41: undefined reference to `cvGrabFrame'
/home/rufat/Desktop/hello/Hello/main.cpp:47: undefined reference to `cvRetrieveFrame'
/home/rufat/Desktop/hello/Hello/main.cpp:49: undefined reference to `cvShowImage'
/home/rufat/Desktop/hello/Hello/main.cpp:50: undefined reference to `cvWaitKey'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
6 errors, 0 warnings

As you can see it doesn't complain that it doesnt know something about headers. He passes "#include "cv.h"" and "#include "highgui.h"" but the problems start at line 36. I added OpenCV's include folder to searchDirectories list.Any suggestions?
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: oBFusCATed on June 07, 2010, 07:35:07 pm
You've not specified the libraries that has the defined the undefined symbols you see.

Project -> Build options  -> Linker
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: uiqbal on November 12, 2011, 12:26:34 pm
Hi All,

I am facing the same problem and I am totally new in OpenCV and Code::Block can any one guide me how to resolve this.
I am using code::block 10.05, OpenCV-2.3.1 and ubuntu 10.10.

Thanks,

Umar
Title: Re: g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)
Post by: MortenMacFly on November 12, 2011, 04:22:17 pm
I am facing the same problem and I am totally new in OpenCV and Code::Block can any one guide me how to resolve this.
Read the OpenCV developer documentation. This will tell what dependencies you'll need to setup. You will need to understand these dependencies anyways! This is a forum about Code::Blocks, not OpenCV. So you are asking the wrong people here - probably 90% of us don't even work with OpenCV.