0

So, I am looking for a way to take fullscreen screenshots on OS X using C++. I found this sample code, which, I think, fits the purpose:

ScreenSnapshot

It is an Xcode project. I managed to compile the .m and .h files using Clang by linking these:

-framework cocoa -framework ApplicationServices -framework Foundation -framework IOKit

Well, here is the problem. The executable spits out:

No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting

What is this Info.plist file? Can I avoid it?

user3496846
  • 1,627
  • 3
  • 16
  • 28

1 Answers1

1

You asked three separate questions in your question (avoid doing that, one question per question is the intended usage):

  • How to compile Xcode project from command line?

    Just cd to the project root directory and run xcodebuild. The .app bundle will be placed under build/Release (might vary depending on your build location configurations in Xcode).

  • How to take fullscreen screenshots on OS X using C++?

    There are plenty of duplicates here on Stack Overflow about this subject. Just search for "screenshot os x c++".

  • What is Info.plist and can you avoid it?

    I cannot answer this so I'll leave it to someone else. There seems to be pretty extensive documentation about it on the Apple Developer site (can be reached by googling "info.plist").

Emil Laine
  • 41,598
  • 9
  • 101
  • 157
  • And the output is a folder full of crud :) I shall need to use this code with my other code, which is not xcode compatible. I need to use gcc (clang). If only your operation gave me an object file to which I could statically link... – user3496846 Jan 10 '16 at 00:13
  • 1
    …you're aware that "folder full of crud" is the standard way Mac OS X applications are bundled, right? –  Jan 10 '16 at 00:14
  • @duskwuff Yeah, I know. But can I statically link to anything inside the folder? I want the functionality to be built into my main program. – user3496846 Jan 10 '16 at 00:19
  • 2
    @user3496846 No. Read the sample code and reuse the appropriate parts. It's not complicated; the core of the application is literally a single function call. –  Jan 10 '16 at 01:27
  • @duskwuff actually thats right, the core is a couple of lines :) Thanks – user3496846 Jan 12 '16 at 18:57