News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

g++: no input files Process terminated with status 1 (0 minutes, 0 seconds)

Started by MRufus, June 04, 2010, 05:22:42 PM

Previous topic - Next topic

MRufus

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?

Jenna

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.

MRufus

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

MRufus

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'

Jenna

Quote from: 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'


It looks like you use an apostrope to surround the pkg-config stuff. You need a backtick ( "`" , french grave accent) here.

oBFusCATed

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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Jenna

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

Jenna

Quote from: 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.

Quote from: jens 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).


Here comes a patch to test:
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]

oBFusCATed

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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Jenna

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(...).

oBFusCATed

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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

MRufus

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?

oBFusCATed

You've not specified the libraries that has the defined the undefined symbols you see.

Project -> Build options  -> Linker
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

uiqbal

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

MortenMacFly

Quote from: uiqbal on November 12, 2011, 12:26:34 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]